1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
import asyncio async def count(): print("before") await asyncio.sleep(3) print("after") async def main(): await asyncio.gather(count(), count(), count()) i = 0 while i < 3000000: i += 1 print("done") asyncio.run(main())