06 2019 档案
python随机验证码(数字和字母组合)
摘要:import random# 生成随机验证码# 数字验证码check_code = ''for i in range(4): current = random.randint(1, 9) check_code += str(current)print(check_code)# 随机字母+数字验证码c
阅读全文
python信用卡操作
摘要:import datetimeuser_dict = dict() # 用来存储用户的账号# 注册系统:def registered(): try: print('welcome to register ATM system') registered_user = input('请输入您的账号:')
阅读全文
python生成器
摘要:生成器generator1.生成器generator只有在调用的时候才会产生数据2.只记录当前的位置3.只有__next__()方法list_file = (i * 2 for i in range(10))print(list_file) # __next__:下一个print(list_file
阅读全文
python_装饰器之页面登陆验证
摘要:import timedef auth(func): def wrapper(*args, **kwargs): username = input('username:').strip() password = input('password:').strip() if username == 'a
阅读全文
python装饰器
摘要:装饰器:本身就是个函数,用来给其他函数增加附加的功能def log(): pass def function(): pass log() def funciton2(): pass log() # 函数的调用装饰器原则:1.不能修改被装饰的函数的源代码2.不能修改被装饰的函数的调用方式3.装饰器对被
阅读全文
python进度条
摘要:import sys, time# 进度条的打印for i in range(20): sys.stdout.write('*') sys.stdout.flush() # 强制刷新 time.sleep(0.1)
阅读全文
python购物车程序
摘要:''' 1. 输入用户的工资 2.根据用户的工工资进行选择性的购买 3.最后打印用户购买的产品和用户的余额'''product_list = [ ('iphone', 5000), ('mar pro', 8000), ('ipad', 7000), ('iphone', 15000)]shoppi
阅读全文
python二级登陆菜单
摘要:""" 1.三级菜单 注册 登陆 注销 2.进入每一个一级菜单,都会有下一级的菜单"""user_item = dict()try: while True: print(' Welcome sir ') input_choice = int(input('Please enter your choi
阅读全文
python学习第一天
摘要:''' 1.输入用户名和密码 2.认证成功后显示欢迎信息 3.输错三次后锁定'''""" 1.对于用户输入密码的时候,输入错误的异常buhuo 2.如果用户在输入的时候,输入的账号不存在已经锁的列表中,则需要再次进行新的注册"""right_item = dict() # 用来存储第一次用户输入的正
阅读全文
浙公网安备 33010602011771号