shutil()
shutil module provides us a number of high-level operations on files. We can copy and remove files and directories. Let’s get started with the module and learn the practical implementation of each of the files in detail.
Reference : shutil-High-level file operations official docs
Copy Files
import shutil
f=open('data.txt','r')
f1=open('data1.txt','w')
# Syntax: shutil.copyfileobj(src,dst)
shutil.copyfileobj(f,f1)
f.close()
f1.close()import shutil
#shutil.copy(src.dst)
shutil.copy('data.txt','data1.txt')Move(src,dst)
disk_usage(path)
Which()
Last updated
Was this helpful?