Python Programming - Standard Libraries - Discussion

Discussion Forum : Standard Libraries - General Questions (Q.No. 73)
73.
How can you use the shutil module in Python to copy a file from one location to another?
shutil.copy_file(src, dst)
shutil.move_file(src, dst)
shutil.copy(src, dst)
shutil.move(src, dst)
Answer: Option
Explanation:
import shutil

# Example usage of shutil module for copying a file
source_path = 'file.txt'
destination_path = 'copy_of_file.txt'
shutil.copy(source_path, destination_path)
Discussion:
Be the first person to comment on this question !

Post your comments here:

Your comments will be displayed after verification.