Skip to content

Instantly share code, notes, and snippets.

@amitnabarro
Created December 10, 2017 12:33
Show Gist options
  • Save amitnabarro/925f064f618e39570a66e58cf5384ffe to your computer and use it in GitHub Desktop.
Save amitnabarro/925f064f618e39570a66e58cf5384ffe to your computer and use it in GitHub Desktop.
Wait for stuff
import asyncio
import time
async def wait_for_stuff():
start = time.time()
for i in range(0, 5):
await asyncio.sleep(1)
print('Time elapsed: %d seconds' % int(time.time() - start))
try:
loop = asyncio.get_event_loop()
loop.run_until_complete(wait_for_stuff())
finally:
loop.close()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment