摘要: 简单流程(无返回值)code1 = 'for i in range (0,10):print(i)' compile1 = compile(code1,'','exec') exec(compile1) 简单计算(有返回值) code2 = '1+2+3+4' compile2 = compile(code2,'','eval') print(eval(compile2)) 简单交互 code3... 阅读全文
posted @ 2018-11-25 23:16 钟馗君 阅读(75) 评论(0) 推荐(0) 编辑
摘要: g = (i for i in range(10)) print(g) for i in g: print(i) 阅读全文
posted @ 2018-10-13 16:49 钟馗君 阅读(76) 评论(0) 推荐(0) 编辑
摘要: def wrapper(func): #qqxing def inner(*args,**kwargs): ret = func(*args,**kwargs) #被装饰的函数 return ret return inner @wrapper #qqxing = wrapper(qqxing) def qqxing(): ... 阅读全文
posted @ 2018-10-13 16:41 钟馗君 阅读(76) 评论(0) 推荐(0) 编辑
摘要: def tail(filename): f = open(filename,encoding='utf-8') while True: line = f.readline() if line: yield line.strip() g = tail('file') for i in g: print(i) 阅读全文
posted @ 2018-09-22 23:27 钟馗君 阅读(90) 评论(0) 推荐(0) 编辑
摘要: 开放封闭原则 依赖倒置原则 阅读全文
posted @ 2018-08-25 12:18 钟馗君 阅读(71) 评论(0) 推荐(0) 编辑
摘要: # Python基础数据类型考试题# 考试时间:两个半小时 满分100分(80分以上包含80分及格)# 一,基础题。# 1,简述变量命名规范(3分)# 答:变量名是由数字、字母、下划线任意组合,变量名要具有描述性,不能是Python关键字,不能是数字开头,不能是中文。# 2,字节和位的关系。(2分) 阅读全文
posted @ 2018-07-07 10:47 钟馗君 阅读(782) 评论(0) 推荐(0) 编辑
摘要: #_author: "Zoom" #data: 2018/6/21 username = input('请输入你要注册的用户名:') password = input('请输入你要注册的密码:') with open('list_of_info',mode='w',encoding='utf-8') as f: f.write('{}\n{}'.format(username,pas... 阅读全文
posted @ 2018-06-26 14:26 钟馗君 阅读(134) 评论(0) 推荐(0) 编辑
摘要: region = { '北京':{ '朝阳区':{ '海淀男孩' } },'上海':{ '浦东区':{ '花旗银行' } }}region_mirroring = regionparent_layers = []while True: for key in region_m... 阅读全文
posted @ 2018-06-06 10:44 钟馗君 阅读(161) 评论(0) 推荐(0) 编辑
摘要: 字符串方法 阅读全文
posted @ 2018-05-23 10:39 钟馗君 阅读(103) 评论(0) 推荐(0) 编辑
摘要: 红字为不熟,给自己小拓展,有商品数量,商品购买后叠加。 阅读全文
posted @ 2018-05-14 15:56 钟馗君 阅读(131) 评论(0) 推荐(0) 编辑