aiopen⚓︎
Install: pip install aiopen
Breaking change (v0.9.0): the
aiopenmodule is no longer callable. Replaceimport aiopen; aiopen(...)withfrom aiopen import aiopen; aiopen(...).
Async-open
Why not use aiofiles?
- Wanted more type annotations
- aiofiles uses ye ole
@coroutinedecorator -- aiopen uses python3.6+async/await
(Big shouts out to the aiofiles people, aiopen is entirely based off of aiofiles)
Usage⚓︎
Just import it!
from aiopen import aiopen
async with aiopen("afile.txt", "w") as f:
await f.write("some text!")
async with aiopen("afile.txt", "r") as f:
content = await f.read()
print(content)