Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import asyncio
- async def task(n):
- result = []
- for i in range(1, n+1):
- result.append((n, i))
- return result
- async def main():
- awaitables = []
- for k in range(1,10):
- t = task(k)
- awaitables.append(t)
- results = await asyncio.gather(*awaitables)
- for task_result in results:
- print(task_result)
- asyncio.run(main(), debug=True)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement