doc/write

This commit is contained in:
Marc Beninca 2024-09-17 23:05:00 +02:00
parent b05de437d0
commit eb0f862125
Signed by: marc.beninca
GPG key ID: 9C7613450C80C24F

View file

@ -83,6 +83,14 @@ def wipe(path: Path) -> None:
def write(file_path: Path, text: str, charset: str = CHARSET) -> None: def write(file_path: Path, text: str, charset: str = CHARSET) -> None:
"""Write text into a file.""" """Write text into a file.
:param file_path: target file path
:type file_path: Path
:param text: content to write
:type text: str
:param charset: charset to use for encoding ouput
:type charset: str
"""
with file_path.open(encoding=charset, mode="w") as file_object: with file_path.open(encoding=charset, mode="w") as file_object:
file_object.write(text) file_object.write(text)