get_folder
- lib.utils.get_folder(path: str, make_folder: bool = True) str
Return a path to a folder, creating it if it doesn’t exist
- Parameters:
path (str) – The path to the folder to obtain
make_folder (bool) –
Trueif the folder should be created if it does not already exist,Falseif the folder should not be created
- Returns:
The path to the requested folder. If make_folder is set to
Falseand the requested pathdoes not exist, then
Noneis returned
- Return type:
str
Example
>>> from lib.utils import get_folder >>> get_folder('/tmp/my_folder') '/tmp/my_folder'
>>> get_folder('/tmp/my_folder', make_folder=False) ''