def consumer(): while True: x = yield print('处理了数据:',x) def producer(): pass c = consumer() #构建一个生成器 next(c) #一开始先next, 走到x=yield c.send(1) print(c) >>> *** 1 <generator object consumer at 0x01EB5150>