Advertisement
dipollwody

Untitled

Dec 14th, 2019
139
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.06 KB | None | 0 0
  1. import sys
  2. import os
  3. import time
  4. import linecache
  5.  
  6. path = path6 = "12.0 praca z plikiem i folderem/data/plik1.txt"
  7.  
  8. dir_path6 = os.path.dirname(path6)
  9.  
  10. os.makedirs(dir_path6)
  11.  
  12.  
  13. def main():
  14.  
  15. rejestr() #stała
  16. rej()
  17. login()
  18. rej1()
  19. login2()
  20. data()
  21. porej()
  22. login3()
  23.  
  24.  
  25.  
  26.  
  27.  
  28.  
  29.  
  30. def rejestr():
  31. print ("To jest wiadomość wewnątrz klasy.")
  32. print("zarejestruj się ")
  33.  
  34. def rej():
  35. # Open a file for writing
  36. outputFile = open("12.0 praca z plikiem i folderem/data/plik1.txt", "w")
  37.  
  38. # Get three numbers from the user
  39. text1 = input("Enter first number:")
  40. login()
  41. text1 = username
  42. outputFile.write(str(text1) + "\n")
  43. outputFile.close()
  44. print("Data written")
  45.  
  46. def login():
  47. text1 = username
  48. username = answer1
  49. rej1()
  50. def rej1():
  51. outputFile = open("12.0 praca z plikiem i folderem/data/plik1.txt", "w+")
  52. text2 = input("Enter second number:")
  53. login2()
  54. text2 = password
  55. outputFile.write(str(text2) + "\n")
  56. outputFile.close()
  57. print("Data written")
  58.  
  59. def login2():
  60. text2 = password
  61. password = answer2
  62. data()
  63. def data():
  64. outputFile = open("12.0 praca z plikiem i folderem/data/plik1.txt", "w+")
  65. text3 = input("Enter third number:")
  66. outputFile.close()
  67. print("Data written")
  68. porej()
  69.  
  70.  
  71.  
  72.  
  73. def porej():
  74. # Open a file for reading
  75. # the access mode is r
  76. inputFile = open("12.0 praca z plikiem i folderem/data/plik1.txt", "r")
  77.  
  78. # read the line
  79. data = inputFile.readline()
  80.  
  81. # print line data
  82. print(data)
  83.  
  84. # read another line
  85. data = inputFile.readline()
  86.  
  87. # print
  88. print(data)
  89. # close the file
  90. login()
  91. inputFile.close()
  92. login3()
  93. def login3():
  94. print ("dotarło")
  95. print("Wpisz login : ")
  96. answer1 = input()
  97. rej()
  98. print("wpisz haslo : ")
  99. answer2 = input()
  100. if answer1 == username and answer2 == password:
  101. print("Prawidłowe dane")
  102.  
  103.  
  104. # Call the function
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement