登陆界面
class User(): def __init__(self,name,pwd): self.name=name self.pwd=pwd class Acount(): def __init__(self): self.list=[] def login(self): print("欢迎来到登陆界面") name = input("请输入用户名:") pwd = input("请输入密码:") for user in self.list: if name==user.name and pwd==user.pwd: print("登陆成功") else: print("登陆失败") def regist(self): print("欢迎来到注册界面:") name=input("请输入用户名") pwd= input("请输入密码:") u=User(name,pwd) self.list.append(u) def run(self): while 1: print("1,注册,2,登陆,Q退出") num=input("请输入操作:") if num=="1": self.regist() elif num=="2": self.login() elif num.upper()=="Q": print("退出") break else: print("你个傻×") user=Acount() user.run()
原文地址:https://www.cnblogs.com/--1234/p/11039896.html
时间: 2024-11-09 01:08:02