0221判断登录是否成功小程序

user_name = input("请输入你的用户名:")
user_passwd = input("请输入你的密码:")
f = open("user01","r+",encoding="utf-8")
f_bak = open("user01_record","a+",encoding="utf-8")
for line in f.readlines():
if user_name and user_passwd in line:
line = user_name and user_passwd
f_bak.write("%s登录成功!\n"% line)
print("登录成功!")
break
elif user_name or user_passwd not in line:
line = user_name
f_bak.write("%s登录失败!\n"% line)
print("登录失败!")
break
f.close()
f_bak.close()
posted on 2017-02-21 19:20  绿洲2017  阅读(191)  评论(0编辑  收藏  举报