OS. path and pythonos. path in the python Module
Operations on the file path
The OS. path. split (p) function returns the directory name and file name of a path.
OS. path. splitext (): separates file names and extensions
The OS. path. isfile () and OS. path. isdir () functions verify whether the given path is a file or a directory.
OS. path. isabs (path): determines whether a path is an absolute path.
The OS. path. exists () function is used to check whether the GIVEN path actually exists.
OS. path. getsize (name): Get the file size. If the name is a directory, return 0L
OS. path. getatime (path) returns the last access time of the file or directory pointed to by path.
OS. path. getmtime (path) returns the last modification time of the file or directory pointed to by path.
OS. path. normpath (path): standard path string format
>>> OS. path. normpath ('C: // windows \ System32 \ ../Temp /')
'C: \ windows \ Temp'
OS. path. join (path, name): Connection directory and file name or directory
OS. path. basename (path): returns the file name.
OS. path. dirname (path) returns the path directory. It is actually the first element of OS. path. split (path ).
OS. path. abspath (path) returns the absolute path of path normalization.
>>> Import OS. path
>>> OS. path. abspath ('C. py ')
'/Root/py/c. py'
>>> OS. path. abspath ('../py/c. py ')
'/Root/py/c. py'