摘要: 在两个任务之间互相切换-协程 def func(): print(1) x = yield 'aaa' print(x) yield 'bbb' g = func() print(next(g)) ##接收的返回值 print(g.send(****)) ##传给了x #得到结果: 1 aaa ** 阅读全文
posted @ 2018-08-01 15:49 九月江 阅读(95) 评论(0) 推荐(0) 编辑
摘要: #数据库连接 import time import random from threading import Event,Thread def check(e): """检测一下数据库的网络和我的网络是否通""" print('正在检测两台机器之间的网络情况....') time.sleep(ran 阅读全文
posted @ 2018-08-01 15:49 九月江 阅读(120) 评论(0) 推荐(0) 编辑