Created
May 6, 2020 00:08
-
-
Save EwertonBello/4d9f7dce931fca169eba2616b89f21ca to your computer and use it in GitHub Desktop.
exemplo simples de parallelism com 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 | |
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