Advertisement
Guest User

Untitled

a guest
Aug 17th, 2018
347
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.33 KB | None | 0 0
  1. import asyncio
  2.  
  3. async def doit():
  4.     print('main')
  5.     await asyncio.sleep(1)
  6.     1/0
  7.  
  8. def main():
  9.     loop = asyncio.get_event_loop()
  10.     for _ in range(3):
  11.         fut = loop.create_task(doit())
  12.         try:
  13.             loop.run_until_complete(fut)
  14.         except ZeroDivisionError:
  15.             print('again')
  16.  
  17. main()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement