I've got a CSV with some information in and the code will iterate through each line in the CSV, and if the username that's entered matches the value in the line, it will allow the user to log in.
However, I'm not sure how to allow my program to say when their details aren't correct. The "not found" prints out after every iteration rather than at the end of the CSV.
How could I make it so that once it's at the end of the for loop, it says that the details aren't found?
Thanks.
username = str(input("Enter your username: "))
password = str(input("Enter your password: "))
file = open("details.csv","r")
print('Details opened')
contents = csv.reader(file)
print('reader established')
for row in contents:
print('begin loop')
if username == row[4]:
print("Username found")
if password == row[3]:
print("Password found")
main()
else:
print("not found")