Advertisement
Atheuz

Untitled

May 30th, 2020
1,286
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.39 KB | None | 0 0
  1. import asyncio
  2.  
  3. async def task(n):
  4.     result = []
  5.     for i in range(1, n+1):
  6.         result.append((n, i))
  7.     return result
  8.  
  9. async def main():
  10.     n = 1
  11.     while True:
  12.         t = task(n)
  13.         result = await t
  14.         print(result, "sleeping for 5 seconds")
  15.         await asyncio.sleep(5)
  16.         n += 1
  17.  
  18. if __name__ == '__main__':
  19.     asyncio.run(main(), debug=True)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement