Created
December 11, 2017 07:24
-
-
Save upgradeQ/784e3ebee6f0a1e0648b38c7f60f9ff1 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 aiofiles | |
import asyncio | |
async def red(): | |
print('where did lost ') | |
async with aiofiles.open('data.txt', mode='r') as f: | |
contents = await f.read() | |
return contents | |
events = asyncio.get_event_loop() | |
try: | |
coro = events.run_until_complete(red()) | |
print('files content is: "{}"'.format(coro)) | |
finally: | |
print('end') | |
events.close() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment