Last active
November 23, 2021 20:08
-
-
Save nmchenry01/9a21749c3f9370e79019b372b7973177 to your computer and use it in GitHub Desktop.
A working example of running a coroutine
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import asyncio | |
| async def something_async(): | |
| # Wait 3 seconds | |
| await asyncio.sleep(3) | |
| return "Now we're cooking with fire!" | |
| async def main(): | |
| result = await something_async() | |
| print(result) | |
| asyncio.run(main()) | |
| # Output: | |
| # | |
| # Now we're cooking with fire! |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment