0
点赞
收藏
分享

微信扫一扫

python create_future

灵魂跑者 2023-11-22 阅读 23

 

 

import asyncio

async def main():
    loop = asyncio.get_running_loop()
    future = loop.create_future()
    print("Future created:", future)
    await asyncio.sleep(1)
    future.set_result("Hello, World!")
    print("Result:", await future)

asyncio.run(main())

 



举报

相关推荐

0 条评论