1 use_name = input('请输入需要注册的账号:') 2 pas_word = input('请输入密码:') 3 with open('注册登录', mode='w', encoding='utf-8') as f: 4 f.write('{}\n{}'.format(use_name, pas_word)) 5 print('注册成功') 6 i = 0 7 lis = [] 8 while i < 3: 9 use = input('请输入账号:') 10 pas = input('请输入密码:') 11 with open('注册登录', mode='r', encoding='utf-8') as f1: 12 for lan in f1: 13 lis.append(lan) 14 if use == lis[0].strip() and pas == lis[1].strip(): 15 print('登录成功') 16 break 17 else: 18 print('登录失败')
文件处理写的一个简单的注册登录程序
猜你喜欢
转载自www.cnblogs.com/python884/p/9717356.html
今日推荐
周排行