#lang en <> = Description = [[https://docs.python.org/3/library/pathlib.html|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. = Snippets = == Get home directory == {{{#!highlight python from pathlib import Path p = Path.home() }}} == Concatenate paths == {{{#!highlight python from pathlib import Path p = Path('/root') / 'subfolder' / 'second_subfolder/file.txt' }}} == Get the directory the current script lives in == {{{#!highlight python from pathlib import Path p = Path(__file__).parent.absolute() }}}