第一次寫作業。 一定寫的不好,但我會努力改進。
阿新 • • 發佈:2017-10-28
() pass elif user pri == 作業 name 輸入
f = open("username.txt","r")
y = f.read()
#print(y)
f.close()
p = open("password.txt","r")
p1 = p.read()
#print(p1)
p.close()
a = 0
while True:
c = open("cuo.txt","r")
c1 = c.read()
#print(c1)
c.close()
username = input("請輸入用戶名:")
password = input("請輸入密碼:")
if username == c1:
print("用戶被鎖定。。")
break
elif username == y and password == p1 :
print("輸入正確")
break
elif a == 2 :
c = open("cuo.txt","w")
c.write(username)
c.close()
else:
print("輸入錯誤-----")
a += 1
第一次寫作業。 一定寫的不好,但我會努力改進。