Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import time
- import asyncio
- loop = asyncio.get_event_loop()
- async def a_print(v):
- # time.sleep(v)
- asyncio.sleep(v)
- print(v)
- return v**2
- async def main(sync, v):
- # loop.create_task(a_print(v+1))
- task = loop.create_task(a_print(v+1))
- start()
- print(r)
- r = await task
- # time.sleep(v)
- asyncio.sleep(v)
- print(v)
- def start():
- print(9)
- if __name__ == '__main__':
- loop.run_until_complete(main(start, 1))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement