摘要: 生成器 生成器就是一种自定义的迭代器 生成器对象 # 定义阶段就是一个普通函数 def func(): print('first') yield 111 print('second') yield 222 print('third') # 报错,抛出异常 StopIteration 取到这里就取干净 阅读全文
posted @ 2021-01-04 23:36 山风有耳 阅读(214) 评论(0) 推荐(0) 编辑