zzyuhehe
#!/usr/bin/env python3
# -*- coding:utf-8 -*-
# name:zzyu
welcome = \'\'\'
-----------welcome to home------------
请选择是否为新用户,请在下面提示中输入<y or n>\'\'\'
print (welcome)
new_user = str(input("请输入<y or n>:"))
if new_user == "y":
print ("欢迎注册")
username = str(input("请输入用户名:"))
userpass = str(input("请设置密码:"))
with open(\'user_pass.txt\',\'a\') as file:
file.write("{_username} {_userpass} \n".format(_username=username,_userpass=userpass))
print("欢迎您:{_user_name}".format(_user_name=username))
elif new_user == "n":
dl = str(input("您是否选择登陆,请输入<y or n>:"))
if dl == "y":
username = str(input("请输入用户名:"))
userpass = str(input("请设置密码:"))
with open(\'user_pass.txt\',\'r\') as file1:
# for check in file1.readlines():
check = file1.read()
if username in check and userpass in check:
print ("您好,欢迎回家!!!")
else:
count = 0
while count < 2:
print ("您输入的用户名或密码有误,请重新输入....")
username = str(input("请输入用户名:"))
userpass = str(input("请设置密码:"))
count += 1
if count == 2:
print("您的账号已被锁定......")
else:
print ("BYE BYE")

分类:

技术点:

相关文章:

  • 2021-07-02
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-08-16
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2021-12-23
  • 2022-02-06
  • 2021-08-21
  • 2021-12-25
  • 2022-02-05
  • 2022-02-07
相关资源
相似解决方案