0
您好我想作一個電影流媒體網站的登錄頁面,任何人都可以幫助我提高這個代碼,請Python的登錄頁面
我需要它來保存用戶名和密碼,當它已經做到了我需要的用戶名無效的人誰改掉再次用它做一個帳戶
username = input("Please enter your username : ")
password = input("Please enter your password : ")
print ("Greetings," , username, "Please re enter your password to confirm
it")
command = input("Please type a command :")
if command == "log off":
print("You have now been logged off again",username)
username == ""
password == ""
username = input("Please enter your username : ")
password = input("Please enter your password : ")
while username != "username" and password != "password":
print (" Sorry username and password incorrect please re-enter for
validation ")
username = input("Please enter your username : ")
password = input("Please enter your password : ")
else:
print ("Greetings," , username, "you are now logged in now with your new
password")
username = input("Please enter your username : ")
password = input("Please enter your password : ")
print ("Greetings," , username, "Please re enter your password to confirm
it")
command = input("Please type a command :")
if command == "log off":
print("You have now been logged off again",username)
username == ""
password == ""
file = open("testfile.txt","w")
file.write("Usernames and Passwords")
file.write(("Username :") username + ("Password :") password)
file.close()
的一些技巧,遵循**幹原則**,因爲你重複了很多代碼,它我也不清楚你在問什麼。你的具體問題是什麼? – Ludisposed
我需要創建一個登錄頁面,將用戶名和密碼保存到一個文件中,然後您可以與該用戶登錄 – ThatSkeptic
再次強調您的代碼格式不正確,'if'' else'語句沒有縮進 – Ludisposed