基本上,我正在尝试为我的登录系统创建一个id,出于某种原因,当我将我的id添加到其中时,它似乎只有在我添加它时才起作用。我的目标是让它从0001、0002、0003等开始,但我不知道怎么做。我想在创建用户之前添加id
我尝试过所有不同的方法,比如在代码行中添加int
f.write(create_user + ' : ' + create_pass + "\n")
def register():
createid = (random.randint(1000, 2000))
create_user = input("Create your username: ")
create_pass = input("Create your password: ")
f = open("users.txt" , "a")
f.write(create_user + ' : ' + create_pass + "\n")
f.close
当我把密码
f.write(createid, create_user + ' : ' + create_pass + "\n")
它在VisualStudio代码中提供
Exception has occurred: TypeError write() takes exactly one argument (2 given) File "D:\Desktop\python\login.py", line 33, in register f.write(createid, create_user + ' : ' + create_pass + "\n") File "D:\Desktop\python\login.py", line 20, in start register() File "D:\Desktop\python\login.py", line 94, in start()
试试这个
相关问题 更多 >
编程相关推荐