663 B
663 B
Chapter 9 – Organizing Files
Q: 1. What is the difference between
shutil.copy()andshutil.copytree()?
shutil.copy() copies the file, shutil.copytree() copies the directory.
Q: 2. What function is used to rename files?
shutil.move()
Q: 3. What is the difference between the delete functions in the
send2trashandshutilmodules?
send2trash will move file to recycle bin, while shutil functions will permanently delete files and folders.
Q: 4.
ZipFileobjects have aclose()method just likeFileobjects’close()method. WhatZipFilemethod is equivalent toFileobjects’open()method?
zipfile.ZipFile().