九、【轉載】Python生成器generator之next和send運行流程

九、【轉載】Python生成器generator之next和send運行流程 def consumer(): r = 'here' for i in range(3): yield r r = '200 OK' + str(i) c = consumer() n1 = next(c) n2 = next(c) n3 = next(c) 對於普通的生
相關文章
相關標籤/搜索