Difference between psutil & shutil modules in pyhton :)
shutil
stands for "shell utilities" and provides a set of high-level operations on files and collections of files, such as copying, moving, and deleting. It is mainly used for file and directory manipulation tasks. For example, you can use the shutil.copy()
function to copy a file, or shutil.rmtree()
to delete a directory and its contents.
psutil
stands for "process and system utilities" and provides an interface for retrieving information about system resources, such as CPU, memory, disk usage, and network connections. It is mainly used for monitoring and controlling system processes. For example, you can use the psutil.cpu_percent()
function to get the current CPU usage, or psutil.Process(pid).kill()
to terminate a process with a specific PID (process ID).