Skip to content

Instantly share code, notes, and snippets.

@velotiotech
Created October 23, 2020 05:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save velotiotech/cfa3219da51ef24218c33706971516de to your computer and use it in GitHub Desktop.
Save velotiotech/cfa3219da51ef24218c33706971516de to your computer and use it in GitHub Desktop.
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