shutil.copy() # copy the file
shutil.copytree() # copy the directory
shutil.move() # moves files
shutil.rmtree() # remove directory
tmpfile.mkstemp() # temporary file
filecmp.cmp() # compare file
filecmp.cmpfiles() # compare directory
os.getcwd() # get working directory
os.chdir() # change working directory
os.access() # access check
os.listdir() # list of directories and files
os.stat() # file information
os.mkdir() # make directory
os.makedirs() # create a directory and intermediate directories
os.rmdir() # remove empty directories
os.removedirs() # remove empty directories
os.remove() # remove
os.walk() # execute all the directories tree
glob.glob() # get a list of files and folders on a mask
os.path.abspath() # absolute path
os.path.isabs() # check that the path absalyutno
os.path.realpath() # the canonical path to the OS
os.path.dirname() # get out of the way only to directory
os.path.basename () # get out of the way the file name
os.path.join() # join path directory and file
os.path.isfile() # check if this object is file
os.path.isdir() # check if this object is a directory
os.path.getsize() # get size file or directory
os.path.exists() # check if this object exists
os.path.getctime() # get time when file was created
os.path.getmtime() # get time when file was changed
10/17/15
Python work with files and directories
Very often there is a need to work with files in Python.
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment