随笔分类 -  python基础

摘要:import time def consumer(name): print("%s 准备吃包子啦!" %name) while True: baozi = yield print("包子[%s]来了,被[%s]吃了!" %(baozi,name)) def producer(name,name1): c = consumer(name) ... 阅读全文
posted @ 2017-09-21 17:39 bruce61 阅读(103) 评论(0) 推荐(0)
摘要:#无传参版 import time def timer(func):# 函数test当做了一个变量传给了func def conut(): start_time=time.time() func() stop_time=time.time() print('the func run time is %s'%(stop_tim... 阅读全文
posted @ 2017-09-21 10:24 bruce61 阅读(138) 评论(0) 推荐(0)
摘要:while True: username = input('name:').strip() password = input('passwd:').strip() if len(username) != 0 and len(password) != 0: with open('user_file','r',encoding='utf8') as f: ... 阅读全文
posted @ 2017-09-18 17:45 bruce61 阅读(129) 评论(0) 推荐(0)