Created
October 23, 2020 05:49
-
-
Save velotiotech/cfa3219da51ef24218c33706971516de 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 async_func(task_no): | |
print(f'{task_no} :Velotio ...') | |
await asyncio.sleep(1) | |
print(f'{task_no}... Blog!') | |
async def main(): | |
taskA = loop.create_task (async_func('taskA')) | |
taskB = loop.create_task(async_func('taskB')) | |
taskC = loop.create_task(async_func('taskC')) | |
await asyncio.wait([taskA,taskB,taskC]) | |
if __name__ == "__main__": | |
try: | |
loop = asyncio.get_event_loop() | |
loop.run_until_complete(main()) | |
except : | |
pass |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment