Import OS
Os.path.join (a,b,c) #abc为str
Stitching paths
>>> os.path.join (' d:\\ ', ' f ', ' study ')
' d:\\f\\study '
>>> os.path.join (' A ', ' B ', ' V ')
' A\\b\\v '
Os.path.abspath (a)
Returns the absolute path of a
>>> os.path.abspath (' news.txt ')
' c:\\python34\\news.txt '
Os.path.split (PATH)
Split addresses into directories and file names to return
>>> os.path.split (' C:\Python34\Lib\dbm\gnu.py ')
(' c:\\python34\\lib\\dbm ', ' gnu.py ')
Os.path.dirname (PATH)
Returns the absolute address of the directory where path is located
>>> os.path.dirname (' C:\Python34\Lib\dbm\gnu.py ')
' c:\\python34\\lib\\dbm '
Os.path.basename (PATH)
Returns the last element, the filename
>>> os.path.basename (' C:\Python34\Lib\cgi.py ')
' cgi.py '
Os.path.exists (PATH)
To determine if the path exists, to return true if it exists, false if it does not exist
>>> os.path.exists (' d:\\f\study ')
True
Os.path.isabs (PATH)
Determines whether an absolute path, the return value bool
Os.path.isfile (PATH)
True to determine if path is a file
Os.path.isdir (PATH)
Path is a directory that already exists, return true, or false
Os.path.normcase (PATH)
Converts uppercase in path to lowercase and single slash to double slash
Os.path.getsize (PATH)
Returns the file size (in bytes) of path
Os.path.getatime (PATH)
Returns the last access time for path "return as timestamp"
Os.path.getmtime (PATH)
Returns the last modified time of path, "return as timestamp"
Official documents: https://docs.python.org/3.4/library/os.path.html