G2A Many GEOs
SHARE
TWEET

Untitled

a guest Apr 10th, 2020 126 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. import os
  2.  
  3. from fpdf.py3k import unicode
  4.  
  5. name_letters = {"a":1,
  6. "ą":1,
  7. "b":2,
  8. "c":3,
  9. "ć":3,
  10. "d":4,
  11. "e":5,
  12. "ę":5,
  13. "f":6,
  14. "g":7,
  15. "h":8,
  16. "i":9,
  17. "j":1,
  18. "k":2,
  19. "l":3,
  20. "ł":3,
  21. "m":4,
  22. "n":5,
  23. "ń":5,
  24. "o":6,
  25. "ó":6,
  26. "p":7,
  27. "q":8,
  28. "r":9,
  29. "s":1,
  30. "ś":1,
  31. "t":2,
  32. "u":3,
  33. "v":4,
  34. "w":5,
  35. "x":6,
  36. "y":7,
  37. "z":8,
  38. "ź":8,
  39. "ż":8}
  40. months = {"01":"styczeń",
  41.           "02":"luty",
  42.           "03":"marzec",
  43.           "04":"kwiecień",
  44.           "05":"maj",
  45.           "06":"czerwiec",
  46.           "07":"lipiec",
  47.           "08":"sierpień",
  48.           "09":"wrzesień",
  49.           "10":"październik",
  50.           "11":"listopad",
  51.           "12":"grudzień"}
  52.  
  53. from fpdf import FPDF
  54.  
  55. def numerology_name(name):
  56.     name_sum=0
  57.     sum_sum=0
  58.     for letter in name.strip().lower():
  59.         name_sum+=name_letters[letter]
  60.     ns_copy=name_sum
  61.     while ns_copy>9:
  62.         for number in str(ns_copy):
  63.             sum_sum+=int(number)
  64.         ns_copy=sum_sum
  65.         sum_sum=0
  66.     print("imię:", ns_copy)
  67.     return str(ns_copy)
  68.  
  69.  
  70. def numerology_date(date):
  71.     birth_sum=0
  72.     sum_sum=0
  73.     for number in date.strip().lower():
  74.         birth_sum+=int(number)
  75.     bs_copy=birth_sum
  76.     while bs_copy>9:
  77.         for number in str(bs_copy):
  78.             sum_sum+=int(number)
  79.         bs_copy=sum_sum
  80.         sum_sum=0
  81.     print("data urodzenia:", bs_copy)
  82.     return str(bs_copy)
  83.  
  84.  
  85. if __name__ == '__main__':
  86.     text_var=''
  87.     fp = open("person.txt", encoding='utf-8')
  88.     new_file = open("raport.txt", "w")
  89.     name_num=numerology_name(fp.readline())
  90.     date_of_birth = fp.readline()
  91.     date_num=numerology_date(date_of_birth)
  92.     new_file.write("Numerologia imienia: "+name_num+"\n")
  93.     new_file.write(open(name_num+".txt").read()+"\n\n")
  94.     new_file.write("Numerologia daty urodzenia: "+date_num+"\n")
  95.     text_var="Numerologia imienia: "+name_num+"\n"+open(name_num+".txt").read()+"\n\n"+"Numerologia daty urodzenia: "+date_num+"\n"
  96.     fp.close()
  97.     new_file.close()
  98.     print("miesiąc urodzenia:", months[date_of_birth[4:6]])
  99.  
  100.     if date_of_birth[4:6]=='05':
  101.         source=open(months[date_of_birth[4:6]]+".txt", encoding='utf-8')
  102.         text_var+=source.read()
  103.         new_file=open("raport.txt", "a")
  104.         new_file.write(source.read())
  105.         new_file.close()
  106.         source.close()
  107.     pdf = FPDF()
  108.     pdf.add_page()
  109.     pdf.add_font('DejaVu', '', 'C:/Windows/fonts/DejaVuSans.ttf', uni=True)
  110.     pdf.set_font('DejaVu', '', 12)
  111.  
  112.     for txt in text_var.split('\n'):
  113.         # print(type(txt))
  114.         # pdf.write(8, iconv('UTF-8', 'iso-8859-2//TRANSLIT//IGNORE', txt))
  115.         pdf.write(8, txt)
  116.         # pdf.write(8, "zażółć gęślą jaźń")
  117.         pdf.ln(8)
  118.     pdf.output("simple_demo.pdf")
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Top