Advertisement
Guest User

Untitled

a guest
Jan 23rd, 2017
91
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.97 KB | None | 0 0
  1. def login():
  2. print("LOGIN SCREEN")
  3. #open the file we are reading from
  4. with open("file.txt",'r') as file:
  5. #prompt the user to enter their login details
  6. username=input("Enter username")
  7. password=input("Enter password")
  8. #call upon our reader (this allows us to work with our file)
  9. fileReader=csv.reader(file)
  10. #for each row that is read by the Reader
  11. for row in fileReader:
  12. #print(row[0]) - this would print the first field in the row (the username)
  13. #print(row[1]) - this would print the second field in the row (the password)
  14. #search for the required matches in user entry against what is stored in the file
  15. if username==row[0] and password==row[1]:
  16. print("access granted")
  17. else:
  18. print("denied")
  19. menu()
  20.  
  21. JoeBloggs1979,Open@123,Joe,Bloggs,10/01/1979,144 CWRoad,CR30AX,Female,Thriller,joey@hotmail.com
  22.  
  23. PigacheeMoose2016,Carrots@123,pigachee,moose,12/05/2016,Picachh Drive,CR3 CCC,Female,PIgness,mmf@hotmail.com
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement