Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import asyncio
- import datetime
- async def foo():
- now = datetime.now()
- ten_mins_from_now=now + datetime.timedelta(minutes=10)
- while datetime.now()< ten_mins_from_now: # must be changed into a coroutine?
- sleep(30)
- return 'foo has returned'
- async def print_job():
- print('can i print before foo() returns?')
- async def main():
- await foo():
- await print_job()
- asyncio.run(main())
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement