files.py 196 B

123456789
  1. from typing import AnyStr
  2. import aiofiles
  3. async def write_file(path: str, content: AnyStr, mode: str = 'w'):
  4. async with aiofiles.open(path, mode) as file:
  5. await file.write(content)