2019年6月28日
摘要: import random# 生成随机验证码# 数字验证码check_code = ''for i in range(4): current = random.randint(1, 9) check_code += str(current)print(check_code)# 随机字母+数字验证码c 阅读全文
posted @ 2019-06-28 17:29 Yihan_07 阅读(3456) 评论(0) 推荐(0) 编辑
  2019年6月27日
摘要: import datetimeuser_dict = dict() # 用来存储用户的账号# 注册系统:def registered(): try: print('welcome to register ATM system') registered_user = input('请输入您的账号:') 阅读全文
posted @ 2019-06-27 17:34 Yihan_07 阅读(732) 评论(2) 推荐(0) 编辑
摘要: 生成器generator1.生成器generator只有在调用的时候才会产生数据2.只记录当前的位置3.只有__next__()方法list_file = (i * 2 for i in range(10))print(list_file) # __next__:下一个print(list_file 阅读全文
posted @ 2019-06-27 13:11 Yihan_07 阅读(227) 评论(0) 推荐(0) 编辑
  2019年6月26日
摘要: import timedef auth(func): def wrapper(*args, **kwargs): username = input('username:').strip() password = input('password:').strip() if username == 'a 阅读全文
posted @ 2019-06-26 16:01 Yihan_07 阅读(660) 评论(0) 推荐(0) 编辑
摘要: 装饰器:本身就是个函数,用来给其他函数增加附加的功能def log(): pass def function(): pass log() def funciton2(): pass log() # 函数的调用装饰器原则:1.不能修改被装饰的函数的源代码2.不能修改被装饰的函数的调用方式3.装饰器对被 阅读全文
posted @ 2019-06-26 12:47 Yihan_07 阅读(227) 评论(0) 推荐(0) 编辑
  2019年6月25日
摘要: import sys, time# 进度条的打印for i in range(20): sys.stdout.write('*') sys.stdout.flush() # 强制刷新 time.sleep(0.1) 阅读全文
posted @ 2019-06-25 15:18 Yihan_07 阅读(125) 评论(0) 推荐(0) 编辑
  2019年6月24日
摘要: ''' 1. 输入用户的工资 2.根据用户的工工资进行选择性的购买 3.最后打印用户购买的产品和用户的余额'''product_list = [ ('iphone', 5000), ('mar pro', 8000), ('ipad', 7000), ('iphone', 15000)]shoppi 阅读全文
posted @ 2019-06-24 12:01 Yihan_07 阅读(365) 评论(2) 推荐(0) 编辑
  2019年6月21日
摘要: """ 1.三级菜单 注册 登陆 注销 2.进入每一个一级菜单,都会有下一级的菜单"""user_item = dict()try: while True: print(' Welcome sir ') input_choice = int(input('Please enter your choi 阅读全文
posted @ 2019-06-21 10:52 Yihan_07 阅读(742) 评论(0) 推荐(0) 编辑
  2019年6月20日
摘要: ''' 1.输入用户名和密码 2.认证成功后显示欢迎信息 3.输错三次后锁定'''""" 1.对于用户输入密码的时候,输入错误的异常buhuo 2.如果用户在输入的时候,输入的账号不存在已经锁的列表中,则需要再次进行新的注册"""right_item = dict() # 用来存储第一次用户输入的正 阅读全文
posted @ 2019-06-20 14:36 Yihan_07 阅读(343) 评论(2) 推荐(1) 编辑