Last active
June 20, 2022 01:05
-
-
Save hclivess/e389dc75864e96a130bb65844fe3ac5d to your computer and use it in GitHub Desktop.
Simplest parallel asyncio
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 | |
import time | |
async def function1(): | |
await asyncio.sleep(2) | |
print("a") | |
async def function2(): | |
print("b") | |
async def main(): | |
await asyncio.gather(function1(), | |
function2()) | |
if __name__ == "__main__": | |
asyncio.run(main()) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
alternative: