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)

Write the string to a file at the specified path.

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

Parameters

string : str

The content you want written to the file.

path : Path

The full path to the file you want to create, including the file name and extension.

Returns

Path

The path to the file that was created.

Raises

FileNotFoundError

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