My first python application
阿新 • • 發佈:2018-12-13
'''
Authon:WSE_Gordon
This application is use for the costomer to login the application.
The Costomer need to input his or her username and password.
But it has a bed part. It is all the password is the same, I need to fix it late.
'''
seq_usernames=[]
seq_passwords=[]
with open("user_table.txt",'r') as f:
first_username = f.readline()[9:]
print(first_username)
seq_usernames.append(first_username)
first_password = f.readline()[9:]
print(first_password)
seq_passwords.append(first_password)
second_username = f.readline()[9:]
print(second_username)
seq_usernames.append(second_username)
second_password = f.readline()[9:]
print(second_password)
seq_passwords.append(second_password)
f.close()
print(seq_usernames)
print(seq_passwords)
seq_user = dict.fromkeys(seq_usernames,'123456')
print(seq_user)
#使用者輸入
i = 0
for i in range(3):
username = input("請輸入使用者名稱username=")
username = username + '\n'
password = input("請輸入密碼password=")
if username in seq_user and password == seq_user.get(username):
print(seq_user.get(username))
print("Congrantulation! You're right!")
break
else:
print("Your are wrong,You need test again!")
i = i + 1
else:
print("Sorry,You don't have time anymore")