如何使此用户名和密码登录页面工作

时间:2017-11-05 20:34:17

标签: python python-3.x

我已经制作了这个代码,试图创建一个简单的“创建用户”#39;接受输入并将它们放入csv文件的程序但是我发现我一直收到错误unexpected EOF while parsing这很烦人。你能帮帮我吗?

if sys.version_info < (3, 0):
    input = raw_input

def createAccount():
  username = enterUsername()
  password = enterPassword()
  appendAccount('All_users.csv', username, password, sname, year, age)

def enterUsername():
    while True:
        name = input('What is your first name?')
        sname = input('What is your surname?')
        year = input('what year are you in?')
        age = input('How old are you?')
        fName = name[:3]
        if len(userN) == 3:
            username = (fName+year)
            print(username)
        elif len(fName) != 3:
            username = (name[:3]+age)


def enterPassword():
    while True:
        password = input('Enter password: ')
        password_again = input('Confirm password: ')
        if len(password) < 5:
            print ('Your password is too short.')
        elif password != password_again:
            print ('Password and confirmation do not match.')
        else:
            return password

def appendAccount(All_users, username, password, sname, year, age):
  with open(All_users, 'a') as csv_file:                                                                        

1 个答案:

答案 0 :(得分:0)

文件的结尾?

SHOW VARIABLES LIKE 'log_bin';