Advertisement
Guest User

Untitled

a guest
Nov 9th, 2020
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.29 KB | None | 0 0
  1. import asyncio
  2.  
  3. async def foo():
  4.     print('foo start')
  5.     await asyncio.sleep(1)
  6.     print('foo end')
  7.  
  8. async def main():
  9.     print('main start')
  10.     asyncio.ensure_future(foo())
  11.     await asyncio.sleep(2)
  12.     print('main end')
  13.  
  14. asyncio.get_event_loop().run_until_complete(main())
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement