OS Path Module

The os.path module supports operations on pathnames, which can be passed as strings or bytes. The functions under os.path differ from the ones under the glob module in that they are used for working with and creating specific paths (rather than just filtering through them under certain criteria).

OS Path Module

Returns the part of a pathname after the last forward-slash.
Returns the part of the pathname ranging from the start to the last forward-slash.
Checks whether a given file or folder exists in the diretory of an operating system.
Returns a string of pathnames delimited with a forward-slash.


Interested in helping build Docs? Read the Contribution Guide or share your thoughts in this feedback form.

Learn Python on Codecademy