Created
October 11, 2021 04:30
-
-
Save ycui1/a2c6de9532ed93fa98cdf383c5a6cb73 to your computer and use it in GitHub Desktop.
This file contains 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 login_user_async(): | |
... await asyncio.sleep(2) | |
... | |
>>> async def load_posts_async(): | |
... await asyncio.sleep(3) | |
... | |
>>> async def launch_app_async(): | |
... print("Open App:", time.asctime()) | |
... await asyncio.gather( | |
... login_user_async(), | |
... load_posts_async() | |
... ) | |
... print("App Page Loaded:", time.asctime()) | |
... | |
>>> asyncio.run(launch_app_async()) | |
Open App: Sun Oct 10 23:29:42 2021 | |
App Page Loaded: Sun Oct 10 23:29:45 2021 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment