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('\n').split(':')[0] and password == msg.strip('\n').split(':')[1]:
print("login successful")
break
else:
print("sb")
count+=1

posted on 2018-09-19 23:28  撩与诗人  阅读(78)  评论(0编辑  收藏  举报