Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import prodavnica
- delimeter= "|"
- def korisnikStr(korisnik):
- return delimiter.join([korisnik["ime"], korisnik["prezime"], korisnik["username"], korisnik["password"]])
- def strKorisnik(line):
- if line[-1] == "\n":
- line = line[:-1]
- ime, prezime, username, password = line.split("|")
- korisnik={
- "ime": ime,
- "prezime": prezime,
- "username": username,
- "password": password
- }
- return korisnik
- def ucitajKorisnike():
- for line in open("prodavci.txt", "r").readlines():
- if len(line) > 1:
- korisnik = strKorisnik(line)
- korisnici.append(korisnik)
- def login():
- username=raw_input("Unesite Vase korisnicko ime: ")
- password=raw_input("Unesite Vasu lozinku: ")
- for korisnik in korisnici:
- if korisnik["username"] == username and korisnik["password"] == password:
- return True
- korisnici = []
- ucitajKorisnike()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement