Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def contains_digit(str):
- for c in str:
- if c.is_digit():
- return True
- return False
- def print_clients():
- for n in get_clients():
- print(n)
- def registration():
- ime = ""
- prz = ""
- user = ""
- passw = ""
- tip = ""
- dict = {}
- exit = 0
- korisnici = get_clients()
- while(exit == 0):
- print("Unesite ime: ")
- input(ime)
- print("Unesite prezime: ")
- input(prz)
- print("Unesite user: ")
- input(user)
- print("Unesite pass: ")
- input(passw)
- print("Unesite tip: ")
- input(tip)
- for n in korisnici:
- if(user == n['user']):
- print("Korisnik vec postoji")
- exit = 1
- if(len(passw) < 6 and contains_digit(passw)):
- print("Potrebna je duza pass")
- exit = 1
- break
- dict = {
- 'user': user,
- 'pass': passw,
- 'ime': ime,
- 'prz': prz,
- 'type': tip
- }
- korisnici.append(dict)
- break
- def get_clients():
- f = open("kupci.txt", "r")
- arr = []
- i = 0
- dict = {}
- for line in f:
- s = line.split("|")
- dict = {
- 'user': s[0],
- 'pass': s[1],
- 'ime': s[2],
- 'prz': s[3],
- 'type': s[4]
- }
- arr.append(dict)
- i = i + 1
- return arr
Add Comment
Please, Sign In to add comment