import asyncioasync def main(): print("hello1") await asyncio.sleep(1) print("hello2")loop = asyncio.get_event_loop()tasks = [main(), main()]loop.run_until_complete(asyncio.wait(tasks))loop.close()
本文共 259 字,大约阅读时间需要 1 分钟。
import asyncioasync def main(): print("hello1") await asyncio.sleep(1) print("hello2")loop = asyncio.get_event_loop()tasks = [main(), main()]loop.run_until_complete(asyncio.wait(tasks))loop.close()
转载于:https://www.cnblogs.com/locbytes/p/11015140.html