注册登录系统
print('=============================================================================================')
print()
print(' ** 欢迎来到XX管理系统 **')
print()
print()
print()
print(' ♦ 1. 登 陆')
print()
print(' ♦ 2. 注 册')
print()
print(' ♦ 3. 退 出')
print()
print('=============================================================================================')
choice_system = int(input('请输入1-3:'))
try:
d = open('./choice_system.txt', 'r', encoding='utf-8')
except:
d = open('./choice_system.txt', 'w', encoding='utf-8')
else:
d = open('./choice_system.txt', 'r', encoding='utf-8')
d.close()
if choice_system == 1:
d = open('./choice_system.txt','r',encoding='utf-8')
admin = input('请输入账号:')
password = input('请输入密码:')
if f'账户:{admin},密码:{password}' == d.read():
print('登陆成功')
d.close()
else:
print('未注册,返回主页面')
choice_system = int(input('请选择2继续注册:'))
if choice_system == 2:
input(f'请输入账号:{admin}')
input(f'请输入密码:{password}')
d = open('./choice_system.txt','w',encoding='utf-8')
d.write(f'账户:{admin},密码:{password}')
d.close()
print('注册登录,请返回主页面选择1进行登录')
choice_system = input('请选择1:')
print('登录成功')
choice_system = int(input('请输入3退出:'))
if choice_system == 3:
print('退出成功!')
elif choice_system == 2:
admin = input(f'请输入账号:')
password = input(f'请输入密码:')
d = open('./choice_system.txt', 'r', encoding='utf-8')
if f'账户:{admin},密码:{password}' == d.read():
print('已经注册,请返回主页面选择1进行登录')
choice_system = input('请选择1:')
print('登录成功')
d.close()
else:
d = open('./choice_system.txt', 'w', encoding='utf-8')
d.write(f'账户:{admin},密码:{password}')
d.close()
print('注册登录,请返回主页面选择1进行登录')
choice_system = input('请选择1:')
print('登录成功')
choice_system = int(input('请输入3退出:'))
if choice_system == 3:
print('退出成功!')