因此,如果您查看第 4 行和第 12 行,您会看到,当我注册时,用户输入的所有内容都应该显示在 txt 文件中,但我没有,如果您查看第 38 行,它会给我一个错误,它告诉我我拥有的一切放在括号之间是不识别的。
from __future__ import with_statement
from asyncore import write
def reg(Ussername, Password, Age, Real_name, Last_name, Email):
global file
file = open ("User_details.txt","a")
file.write("\n"+Ussername+","+Password+","+Age+","+Real_name+","+Last_name+","+Email)
file.close
def login():
pass
def Access():
if option1 == "login":
input ("Ussername: ")
input ("Password: ")
input ("Age: ")
input ("Real name: ")
input ("Last name: ")
input ("Email: ")
login()
else:
print ("Enter all the info we will be asking you to register")
input ("Ussername: ")
input ("Password: ")
input ("Age: ")
input ("Real name: ")
input ("Last name: ")
input ("Email: ")
def begin():
global option1
print ("Hi my name is Steve would you like to register or login")
option1 = input ("Login or Register: ")
if option1 not in ("login", "register"):
begin()
begin()
Access()
reg(Ussername, Password, Age, Real_name, Last_name, Email)