上一页 1 ··· 4 5 6 7 8
摘要: #生成器def MyDemo(M): for i in range(M): yield i**2for item in MyDemo(9): print(item)# #生成器import sysa=(i**2 for i in range(5))while True: try: print(nex 阅读全文
posted @ 2017-08-03 21:26 糖宝虫 阅读(112) 评论(0) 推荐(0) 编辑
摘要: #迭代器import syslist=[1,2,3,4]it=iter(list)while True: try: print(next(it)) except StopIteration: sys.exit() #迭代器it=iter(list)print(next(it))print(next( 阅读全文
posted @ 2017-08-03 19:43 糖宝虫 阅读(85) 评论(0) 推荐(0) 编辑
摘要: import threadingimport time#继承 class threading.Threadclass MyThread(threading.Thread): #类做初始化 def __init__(self,name): #调用hreading.Thread.__init__(sel 阅读全文
posted @ 2017-08-01 21:13 糖宝虫 阅读(116) 评论(0) 推荐(0) 编辑
上一页 1 ··· 4 5 6 7 8