Struggling to read from a file using a for loop.

Joined
Oct 8, 2019
Messages
1
Reaction score
0
Here is some of my code:

username1 = input ("Please enter your username")

file = open ("login.txt","r")
for loop in range(2):
line = file.readline()
data = line.split (",")
if data[1] == username1:
print("Your username is correct, please enter your password")

It doesn't do the if statement after i use the correct username which can be found in the file i have attached below.
Any feedback would be greatly appreciated :)
upload_2019-10-8_15-15-2.png

-Aiden
 

Attachments

  • login.txt
    23 bytes · Views: 130

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,582
Members
45,066
Latest member
VytoKetoReviews

Latest Threads

Top