Advertisement
Guest User

Untitled

a guest
Aug 20th, 2014
199
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. import prodavnica
  2. delimeter= "|"
  3.  
  4.  
  5. def korisnikStr(korisnik):
  6.     return delimiter.join([korisnik["ime"], korisnik["prezime"], korisnik["username"], korisnik["password"]])
  7. def strKorisnik(line):
  8.     if line[-1] == "\n":
  9.         line = line[:-1]
  10.     ime, prezime, username, password = line.split("|")
  11.     korisnik={
  12.         "ime": ime,
  13.         "prezime": prezime,
  14.         "username": username,
  15.         "password": password
  16.     }
  17.     return korisnik  
  18. def ucitajKorisnike():
  19.     for line in open("prodavci.txt", "r").readlines():
  20.         if len(line) > 1:
  21.             korisnik = strKorisnik(line)
  22.             korisnici.append(korisnik)
  23.  
  24. def login():
  25.     username=raw_input("Unesite Vase korisnicko ime: ")
  26.     password=raw_input("Unesite Vasu lozinku: ")
  27.     for korisnik in korisnici:
  28.         if korisnik["username"] == username and korisnik["password"] == password:
  29.             return True
  30.              
  31.  
  32. korisnici = []
  33. ucitajKorisnike()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement