About
File System - Path in Python
Path definition can be found path-like-object
Articles Related
Library
Os.path
To create a path:
- os.path Example with 3/library/os.path.html to create a path from parts
os.path.join("output","log.txt")
Pathlib
Object-oriented filesystem paths
- Concrete
from pathlib import Path
Path('setup.py') # a subclass of PurePath
- Pure classes (They don’t have any OS-accessing operations)
PurePath('/etc', '/usr', 'lib64') # generic, it creates either a PurePosixPath or a PureWindowsPath
PurePosixPath('/etc') # non-Windows filesystem paths
PureWindowsPath('c:/Windows', 'd:bar') # Windows filesystem paths