Skip to content

Instantly share code, notes, and snippets.

@EwertonBello
Created May 6, 2020 00:08
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 EwertonBello/4d9f7dce931fca169eba2616b89f21ca to your computer and use it in GitHub Desktop.
Save EwertonBello/4d9f7dce931fca169eba2616b89f21ca to your computer and use it in GitHub Desktop.
exemplo simples de parallelism com Asyncio
import asyncio
async def tarefa(seg):
await asyncio.sleep(seg)
print(f'Concluído em {seg} segundos...')
async def main():
await asyncio.gather(
tarefa(4),
tarefa(2),
tarefa(3),
)
asyncio.run(main())
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment