eta.util.file
Utilities for reading from and writing to external files.
Functions
Append a string to a given file. |
|
Clear the contents of a file. |
|
Ensure that a directory exists, creating it if it doesn't. |
|
Ensure that a file exists, creating an empty file if it doesn't. |
|
Check if a file exists. |
|
Get the absolute file path for files within this module if in_module is given as True. |
|
Load data from a JSON file. |
|
Read the contents of a given file as a string. |
|
Read the lines of a file as a list, removing whitespace lines. |
|
Remove a file if it exists. |
|
Write a string to a given file. |
|
Write data to a JSON file. |
- get_path(fname, in_module)[source]
Get the absolute file path for files within this module if in_module is given as True.
- read_lines(fname, in_module=False)[source]
Read the lines of a file as a list, removing whitespace lines.