This commit is contained in:
rasbt 2013-12-01 01:05:58 -05:00
parent c7b87b749d
commit 38135aa7b8

View File

@ -56,6 +56,8 @@ os.path.isabs('./some_file.txt') # returns False (not an absolute path)
os.path.abspath('./some_file.txt') os.path.abspath('./some_file.txt')
# create and delete files and directories # create and delete files and directories
os.mkdir('./test') # create a new direcotory os.mkdir('./test') # create a new direcotory
os.rmdir('./test') # removes an empty direcotory os.rmdir('./test') # removes an empty direcotory
@ -66,3 +68,6 @@ shutil.rmtree('./test') # removes directory (empty or not empty)
os.rename('./dir_before', './renamed') # renames directory if destination doesn't exist os.rename('./dir_before', './renamed') # renames directory if destination doesn't exist
shutil.move('./dir_before', './renamed') # renames directory always shutil.move('./dir_before', './renamed') # renames directory always
shutil.copytree('./orig', './copy') # copies a directory recursively
shutil.copyfile('file', 'copy') # copies a file