Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import csv
- account_password = ""
- with open("accounts.csv") as csvfile:
- reader = csv.reader(csvfile)
- while True:
- username = input("nEnter username: ")
- # Checks if username exists
- for row in reader:
- if row[0] == username:
- account_password = row[1] # Get user's password
- break
- password = input("Enter password: ")
- # Check if password is valid
- if password == account_password:
- break
- else:
- print("Username/password is incorrect. Try again.")
- print("nSuccessfully logged in!")
- Tim,myPassword
- John,monkey32
- Fred,WooHoo!
Add Comment
Please, Sign In to add comment