Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save normanlmfung/14fc54b5c2dcfbf92f2f2d0b90ed002f to your computer and use it in GitHub Desktop.
Save normanlmfung/14fc54b5c2dcfbf92f2f2d0b90ed002f to your computer and use it in GitHub Desktop.
python_syntax_asyncio_get_event_loop
import asyncio
async def my_coroutine():
print("Hello,")
await asyncio.sleep(1)
print("world!")
def main():
loop = asyncio.get_event_loop()
try:
loop.run_until_complete(my_coroutine())
finally:
loop.close()
if __name__ == "__main__":
main()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment