OS Path Module

BrandonDusch580 total contributions
Published Jun 25, 2022
Contribute to Docs
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
- .basename()
- Returns the part of a pathname after the last forward-slash.
- .dirname()
- Returns the part of the pathname ranging from the start to the last forward-slash.
- .exists()
- Checks whether a given file or folder exists in the diretory of an operating system.
- .join()
- Returns a string of pathnames delimited with a forward-slash.
Looking to contribute?
- Learn more about how to get involved.
- Edit this page on GitHub to fix an error or make an improvement.
- Submit feedback to let us know how we can improve Docs.