摘要: 1 # Author = Johnston 2 import time 3 def consumer(name): 4 print("%s准备吃包子了。。。" %name) 5 while True: 6 baozi = yield 7 print("%s吃了%s个包子" %(name,baozi) 阅读全文
posted @ 2017-10-04 02:40 游首好咸 阅读(164) 评论(0) 推荐(0)
摘要: 装饰器的作用:扩展函数功能。 特点:1.不修改原函数代码 2.保持调用函数不变 原理:高阶函数 + 嵌套函数 = 装饰器 无参数装饰器 内参装饰器 阅读全文
posted @ 2017-10-04 02:37 游首好咸 阅读(133) 评论(0) 推荐(0)
摘要: 今天跟大家分享两种python 3.x文件读取的方法: 第一种(low loop): f = open("file.txt","r",encoding="utf-8") for line in f.readlines(): print(line) readlines()方法一次性将文件内容以列表的形 阅读全文
posted @ 2017-10-02 22:45 游首好咸 阅读(212) 评论(0) 推荐(0)
点击右上角即可分享
微信分享提示