harmony OS 开发工具安装 安装流程 安装完成 初始配置 双击打开 Running DevEco Studio requires the npm configuration information. You can modify the NPM Registry for an enhanced experience when downloading the npm dependencies. The configuration information is written to the
@生成器generator a=(i*2 for i in range(10)) a.__next__()#等同于next(a),基本都不用,多用for循环a.send(m)#将m传为yield的值 @生成器实例(IO异步的雏形)可看4-11-44-14‘’ import time def consumer(name): print("%s 准备吃包子啦!" %name) while True: baozi = yield print("包子[%s]来了,被[%s]吃了!&q
from multiprocessing import Process, Queue,Pool import time import os def producer(q): for i in range(5): time.sleep(0.6) print("生产第%s个包子" % (i + 1)) res = i + 1 q.put(res) # 没生产一个,往队列里加一个 time.sleep(1) q.put(None) def cousumer(q): while True: r