简单的登录基于代码的

 1 #!/usr/bin/env python
 2 # -*- coding: utf-8 -*-
 3 
 4 import getpass
 5 print('欢迎来到不知名星系购物平台')
 6 i = 0
 7 while i < 3:
 8     user_name = input('上帝,请输入您的购物账号:')
 9     #user_password = int(getpass.getpass('上帝,请输入您的账号密码(数字):'))
10     user_password = str(getpass.getpass('上帝,请输入您的账号密码:'))
11     print(user_name,user_password)
12     #if user_name == 'Bruce' and user_password == 123:
13     if user_name == 'Bruce' and user_password == '123.com':
14         print('上帝,您请选购')
15         break
16     else:
17         print('账号密码错误,请重试')
18     i += 1
19     if i == 3:
20         print('上帝,您多少年没购物了,连账号密码都忘了,多满足一下您信徒的祈祷吧')
原文地址:https://www.cnblogs.com/Bruce-yin/p/6815559.html