write_file

Warning

🚧 Sprout is still in active development and evolving quickly, so the documentation and functionality may not work as described and could undergo substantial changes 🚧

write_file(string: str, path: Path)

Writes a file to the given path with the given content.

The parent folder of the file given in path must exist. If the file already exists, it will be overwritten.

Parameters

string : str

The content to be written to the file.

path : Path

A path of the file to be created, including the file name and extension.

Returns

Path

A path to the file that was created.

Raises

FileNotFoundError

If the parent folder of the file doesn’t exist.