Guest User

Untitled

a guest
Dec 17th, 2017
98
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.39 KB | None | 0 0
  1. def contains_digit(str):
  2. for c in str:
  3. if c.is_digit():
  4. return True
  5.  
  6. return False
  7.  
  8.  
  9. def print_clients():
  10. for n in get_clients():
  11. print(n)
  12.  
  13.  
  14. def registration():
  15. ime = ""
  16. prz = ""
  17. user = ""
  18. passw = ""
  19. tip = ""
  20. dict = {}
  21. exit = 0
  22. korisnici = get_clients()
  23. while(exit == 0):
  24. print("Unesite ime: ")
  25. input(ime)
  26. print("Unesite prezime: ")
  27. input(prz)
  28. print("Unesite user: ")
  29. input(user)
  30. print("Unesite pass: ")
  31. input(passw)
  32. print("Unesite tip: ")
  33. input(tip)
  34.  
  35. for n in korisnici:
  36. if(user == n['user']):
  37. print("Korisnik vec postoji")
  38. exit = 1
  39. if(len(passw) < 6 and contains_digit(passw)):
  40. print("Potrebna je duza pass")
  41. exit = 1
  42. break
  43. dict = {
  44. 'user': user,
  45. 'pass': passw,
  46. 'ime': ime,
  47. 'prz': prz,
  48. 'type': tip
  49. }
  50. korisnici.append(dict)
  51.  
  52. break
  53.  
  54. def get_clients():
  55. f = open("kupci.txt", "r")
  56. arr = []
  57. i = 0
  58. dict = {}
  59. for line in f:
  60. s = line.split("|")
  61. dict = {
  62. 'user': s[0],
  63. 'pass': s[1],
  64. 'ime': s[2],
  65. 'prz': s[3],
  66. 'type': s[4]
  67. }
  68. arr.append(dict)
  69. i = i + 1
  70. return arr
Add Comment
Please, Sign In to add comment