随便在网上找了找,感觉都是讲半天讲不清楚,这里写一下。 def generator(): while True: receive=yield 1 print('extra'+str(receive)) g=generator() print(next(g)) print(g.send(111)) print(next(g)) 输出: 1 extra111 1 extraNone 1 为什么会这样呢,点进send就能看到一句话 send:Resumes the generator and “sends” a value that becomes the result o