2018.09.19python作业

需求:在一个数据文件中,让用户输入信息
with open(r'bd.py',mode='rt',encoding='utf-8') as f:
count=0
while count<=3:
name=input("please input account: ")
password=input("please input password: ")
for msg in f:

if name == msg.strip(' ').split(':')[0] and password == msg.strip(' ').split(':')[1]:
print("login successful")
break
else:
print("sb")
count+=1
原文地址:https://www.cnblogs.com/hello-yuanjing/p/9678344.html