Commit 9cff770a by BellCodeEditor

save project

parent 92ce6ffd
Showing with 7 additions and 3 deletions
...@@ -94,7 +94,11 @@ def register(): # 注册验证 ...@@ -94,7 +94,11 @@ def register(): # 注册验证
elif password1 != password2: elif password1 != password2:
messagebox.showwarning("错误", "两次密码不一致!") messagebox.showwarning("错误", "两次密码不一致!")
else: else:
users[name] = password1 user_info = {}
user_info["password"] = password1
user_info["event"] = ["sb",
"sb"]
users[name] = user_info
content = json.dumps(users) content = json.dumps(users)
with open("user.txt", "w", encoding="utf-8") as file: # "w"每次写入都覆盖原来的内容 with open("user.txt", "w", encoding="utf-8") as file: # "w"每次写入都覆盖原来的内容
file.write(content) file.write(content)
......
{"admin": "admin", "python": "123456", "sb": "114514", "\u4e0a\u73ed": "123456"} {"admin": "admin", "\u4e0a\u73ed": {"password": "123456", "event": ["sb", "sb"]}, "sb": {"password": "sb", "event": ["sb", "sb"]}}
\ No newline at end of file \ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment