is_path_to_dir¶
- pyhelpers.dirs.is_path_to_dir(path_to_dir)[source]¶
Checks if an input string is formatted as a directory path.
This function verifies whether the input string is a valid directory path. See also [DIRS-IVD-1] and [DIRS-IVD-2].
- Parameters:
path_to_dir (str | bytes | pathlib.Path | os.PathLike) – Pathname of a directory.
- Returns:
Trueif the input string is a valid directory path,Falseotherwise.- Return type:
bool
Examples:
>>> from pyhelpers.dirs import cd, is_path_to_dir >>> is_path_to_dir("tests") False >>> is_path_to_dir("/tests") True >>> is_path_to_dir(cd("tests")) True >>> is_path_to_dir(".\tests/") True