import asyncio
# 定义一个异步函数(协程)
async def say_after(delay, what):
await asyncio.sleep(delay)
print(what)
return what
async def my_coroutine():
await say_after(2,"你好")
return "my_coroutine"
print(asyncio.run(my_coroutine()))
python协程入门
最新推荐文章于 2024-07-30 21:09:58 发布
![](https://img-home.csdnimg.cn/images/20240711042549.png)