擅长:python、mysql、java
<p>当循环结束到达文件结尾时,正确的代码为:</p>
<pre><code>file = open("userDetails.txt", "r")
match = False
while match == False:
for each in file:
each = each.split(", ")
realUser = each[1]
realPass = each[2]
if realUser == username and realPass == password:
match = True
print("match")
elif each == "":
username = input("Re-enter username: ")
password = input("Re-enter password: ")
match = False
</code></pre>