# 登录注册系统(有bug,没解决)
print('=======================================')
str1 = ' 1.登录'
print(str1)
str2 = ' 2.注册'
print(str2)
print('=======================================')
change = int(input('请选择1或者2:'))
code_case = open('loginSystem.txt', 'r', encoding='utf-8')
r = code_case.readlines()
r1 = ''.join(r)
r2 = r1.split('\n')
code_case.close()
# print(r2)
if change == 1:
m = str(input('请输入账号:'))
n = str(input('请输入密码:'))
# print(m)
if m in r2 and n in r2:
print('登录成功!')
elif m in r2 and n not in r2:
print('密码错误,请重新输入!')
else:
print('登录失败,该账号未注册!')
if change == 2:
m = input('请输入账号:')
n = input('请输入密码:')
code_case2 = open('loginSystem.txt', 'a', encoding='utf-8')
if m in r2:
print('该账号已注册,请勿重新注册!')
else:
code_case2.write('\n' + m + '\n' + n)
code_case2.close()
print('注册成功!')
02-27
485
![](https://csdnimg.cn/release/blogv2/dist/pc/img/readCountWhite.png)
03-07
381
![](https://csdnimg.cn/release/blogv2/dist/pc/img/readCountWhite.png)
02-28
423
![](https://csdnimg.cn/release/blogv2/dist/pc/img/readCountWhite.png)
02-29
483
![](https://csdnimg.cn/release/blogv2/dist/pc/img/readCountWhite.png)
01-16
411
![](https://csdnimg.cn/release/blogv2/dist/pc/img/readCountWhite.png)
12-11
401
![](https://csdnimg.cn/release/blogv2/dist/pc/img/readCountWhite.png)
11-06
412
![](https://csdnimg.cn/release/blogv2/dist/pc/img/readCountWhite.png)
04-29
1151
![](https://csdnimg.cn/release/blogv2/dist/pc/img/readCountWhite.png)
05-07
772
![](https://csdnimg.cn/release/blogv2/dist/pc/img/readCountWhite.png)
05-10
437
![](https://csdnimg.cn/release/blogv2/dist/pc/img/readCountWhite.png)