#注册 def register(username,password): ''' 注册用户 ''' with open('login','w',encoding='utf-8') as f: s = "\n".join([username,password]) f.write(s+'\n') def login(): uer = input("请输入用户名:") pwd = input("请输入密码:") print('\n') if uer ==username and pwd == password: print('登录成功') if __name__ == '__main__': username = input('请输入账号:\n') password = input('请输入密码:\n') register(username,password) login()
做的注册登录练习
很简单
把注册那快写入文件用来储存账号密码 用python的 join来连接字符串
csdn 地址 https://blog.csdn.net/qq_43233737?spm=1000.2123.3001.5343