Created
July 10, 2019 07:16
-
-
Save haranicle/92644098879aa3344f5fa981d88784b7 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 sleep(s): | |
await asyncio.sleep(s) | |
print("🍣") | |
print(s) | |
return s | |
if __name__ == '__main__': | |
loop = asyncio.get_event_loop() | |
# loop.run_until_complete(sleep(5)) | |
coros = [sleep(3), sleep(2)] | |
futures = asyncio.gather(*coros) | |
loop.run_until_complete(futures) | |
print("🐟") | |
print(futures.result()) | |
loop.close() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment