= Python Os Path =

'''`os.path`''' is a module providing filesystem APIs.

<<TableOfContents>>

----



== Functions ==

||'''Function'''  ||'''Example'''                                                                                                        ||
||`abspath()`     ||see [[Python/PathLib#Methods|Path.absolute]]                                                                         ||
||`basename()`    ||see [[Python/PathLib#Methods|Path.name]]                                                                             ||
||`commonpath()`  ||`commonpath('/usr/lib', '/usr/local')` returns `'/usr'`                                                              ||
||`commonprefix()`||`commonprefix('/usr/lib', '/usr/local')` returns `'/usr/l'`                                                          ||
||`dirname()`     ||see [[Python/PathLib#Methods|Path.parent]]                                                                           ||
||`exists()`      ||see [[Python/PathLib#Methods|Path.exists]]                                                                           ||
||`expanduser()`  ||see [[Python/PathLib#Methods|Path.expanduser]] and [[Python/PathLib#ClassMethods|Path.home]]                         ||
||`expandvars()`  ||variable references like `$name` and `${name}` (and `%name%` on Windows) are replaced with variable values if defined||
||`getatime()`    ||last access time of a file, as a [[Python/Builtins/Types#Float|float]] representing seconds since the epoch          ||
||`getctime()`    ||last metadata change time (Unix) or creation time (Windows) of a file                                                ||
||`getmtime()`    ||last modification time of a file                                                                                     ||
||`getsize()`     ||size of a file                                                                                                       ||
||`isabs()`       ||see [[Python/PathLib#Methods|Path.is_absolute]]                                                                      ||
||`isdir()`       ||see [[Python/PathLib#Methods|Path.is_dir]]                                                                           ||
||`isfile()`      ||see [[Python/PathLib#Methods|Path.is_file]]                                                                          ||
||`islink()`      ||see [[Python/PathLib#Methods|Path.is_symlink]]                                                                       ||
||`join()`        ||see [[Python/PathLib#Methods|Path.joinpath]]                                                                         ||
||`normcase()`    ||on Windows only, push letters to lowercase and replace forward slashes (`/`) with backslashes (`\`)                  ||
||`normpath()`    ||collapse redundant separators and up-level references                                                                ||
||`realpath()`    ||see [[Python/PathLib#Methods|Path.resolve]]                                                                          ||
||`relpath()`     ||see [[Python/PathLib#Methods|Path.relative_to]]                                                                      ||
||`samefile()`    ||see [[Python/PathLib#Methods|Path.samefile]]                                                                         ||
||`sameopenfile()`||test if two open file objects are the same                                                                           ||
||`samestat()`    ||test if two [[Python/Os#Stat_Result|os.stat_result]] instances are the same                                          ||
||`split()`       ||`split('/usr/bin')` returns `('/usr/', 'bin', )`; `split('/usr/')` returns  `('/usr/', '', )`                        ||
||`splitdrive()`  ||on Windows only, split the drive letter or UNC host name off                                                         ||
||`splitext()`    ||see [[Python/PathLib#Methods|Path.stem]] and [[Python/PathLib#Methods|Path.suffix]]                                  ||

----



== See also ==

[[https://docs.python.org/3/library/os.path.html|Python os.path module documentation]]

[[https://pymotw.com/3/os.path/|Python Module of the Day article for os.path]]



----
CategoryRicottone