uniform_pathname¶
- pyhelpers.dirs.uniform_pathname(pathname)[source]¶
Convert a pathname to a standard Linux file path format.
This function serves as an alternative to
path2linux()
.- Parameters:
pathname (str | pathlib.Path) – Absolute or relative pathname.
- Returns:
Standard Linux pathname.
- Return type:
str
Examples:
>>> from pyhelpers.dirs import uniform_pathname >>> import pathlib >>> uniform_pathname("tests\data\dat.csv") 'tests/data/dat.csv' >>> uniform_pathname("tests//data/dat.csv") 'tests/data/dat.csv' >>> uniform_pathname(pathlib.Path("tests\data/dat.csv")) 'tests/data/dat.csv'