This module offers classes representing filesystem paths with semantics appropriate for different operating systems. Path classes are divided between pure paths, which provide purely computational operations without I/O, and concrete paths, which inherit from pure paths but also provide I/O operations.
from pathlib import Path
p = Path.home()
from pathlib import Path
p = Path('/root') / 'subfolder' / 'second_subfolder/file.txt'
from pathlib import Path
p = Path(__file__).parent.absolute()