if(choice1 == "/login"):
uname = input("Username: ")
pword = input("Password: ")
account = str(uname) + str(pword)
with open("accounts.txt") as acc: #CHECKS IF ACCOUNT IS IN DIRECTORY
info = acc.readlines()
for line in info:
if(account in line):
print("Logged in")
loggedin = True
break
我有没有可能使"if(account in line):"
表示为"if(account is exactly the same as in any of the lines here):"
?
尝试一下,
if(choice1 == "/login"):
uname = input("Username: ")
pword = input("Password: ")
account = str(uname) + str(pword)
with open("accounts.txt") as acc: #CHECKS IF ACCOUNT IS IN DIRECTORY
if account in acc.readlines():
print("Logged in")
loggedin = True