17 lines
292 B
Python
17 lines
292 B
Python
import asyncio
|
|
|
|
|
|
async def example():
|
|
await asyncio.sleep(1)
|
|
print("Hello from awake coroutine")
|
|
|
|
|
|
async def main():
|
|
tasks = []
|
|
for _ in range(10):
|
|
task = asyncio.create_task(example())
|
|
tasks.append(task)
|
|
await asyncio.gather(*tasks)
|
|
|
|
|
|
asyncio.run(main())
|