python文件读取操作

 #IO操作
#模拟账号登录 data = [] #0=userName 1=password obj = open("login.txt","r")
for line in obj:
data.append(line.strip("\n"))
obj.close() while True:
print("---------")
print("| 登录 |")
print("---------")
userName = input("input your userName: ")
if(userName == data[0]):
password = input("input your password: ")
if(password == data[1]):
print("登录成功")
break
else:
print("密码错误")
else:
print("账号错误")
上一篇:Oracle12c中性能优化&功能增强新特性之临时undo


下一篇:Java EE平台介绍(译)