为了能到远方,脚下的每一步都不能少.|

bitterteaer

园龄:3年8个月粉丝:1关注:0

python asyncio

例子

import asyncio
async def main():
  print("hello")
  await asyncio.sleep(1)
  print("world")

asyncio.run(main())

主要函数

task = asyncio.create_tas()
res = await asyncio.gather(task1, task2) # res: list

获取返回值

res = await task

本文作者:bitterteaer

本文链接:https://www.cnblogs.com/bitterteaer/p/17379216.html

版权声明:本作品采用知识共享署名-非商业性使用-禁止演绎 2.5 中国大陆许可协议进行许可。

posted @   bitterteaer  阅读(13)  评论(0编辑  收藏  举报
点击右上角即可分享
微信分享提示
评论
收藏
关注
推荐
深色
回顶
收起