tuple:
#元组也是List,但是值不能变
a=('','','')
print(a[1]) mysql=('127.0.0.1','',''root','123456')
print(mysql.count('root')) #例子
all_user={}
while True:
username=input('username:').strip()
passwd=input('passwd:').strip()
cpwd=input('cpwd:').strip()
if username and pwd and cpwd:
if username in all_user:
print('用户名已经存在')
else:
if pwd==cpwd :
all_user[username]=passwd
else:
print('两次密码不一致')
else:
print('账号密码不能空') #登录例子
all_users={}
while True:
username=input('username:').strip()
passwd=input('passwd:').strip()
if username and passwd:
if username in all_users:
passwd=all_users[username]
if passwd==all_users[username]:
print('登录成功')
break
else:
print('密码错误')
else:
print('用户名不存在')
else:
print('用户密码不能为空')