1 #设计一个可以输入3次的登陆程序 2 #用户登录 3 import getpass 4 flag = 3 5 while flag>0 : 6 _usr_ =raw_input(‘please enter your username:‘) 7 _pword_ =getpass.getpass(‘please enter your password:‘)#密文输入 8 if _usr_ ==‘admin‘ and _pword_==‘123456‘: 9 print(‘Login successful!‘) 10 break 11 else : 12 print(‘Check your username and password, please!‘) 13 flag-=1
时间: 2024-10-12 11:35:23