How to use a cross platform directory separator in Python

Different operating systems use different separators between components of file paths. For example, Windows uses “\” to separate components of its file paths, while Unix systems use “/”

Solution for How to use a cross platform directory separator in Python : You can use os.sep to return the operating system’s directory separator Call os.sep to return the character used by the operating system to describe the path to files in the filesystem.


how-to-use-a-cross-platform-directory-separator-in-python