path2linux¶
- pyhelpers.dirs.path2linux(path)[source]¶
Convert a path to a standardized Linux file path format for cross-platform compatibility.
This function:
Formats the file path to ensure compatibility across Windows, Linux and macOS.
Converts an OS-specific path to a standard Linux path.
- Parameters:
path (str | bytes | os.PathLike) – Absolute or relative pathname.
- Returns:
Standard Linux pathname.
- Return type:
str
Examples:
>>> from pyhelpers.dirs import path2linux >>> import pathlib >>> path2linux("tests\data\dat.csv") 'tests/data/dat.csv' >>> path2linux(pathlib.Path("tests\data\dat.csv")) 'tests/data/dat.csv'