doc/write
This commit is contained in:
parent
b05de437d0
commit
eb0f862125
1 changed files with 9 additions and 1 deletions
|
@ -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)
|
||||||
|
|
Loading…
Reference in a new issue