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():
- n = 1
- while True:
- t = task(n)
- result = await t
- print(result, "sleeping for 5 seconds")
- await asyncio.sleep(5)
- n += 1
- if __name__ == '__main__':
- asyncio.run(main(), debug=True)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement