In this article, we would like to show you how to copy file in Python.
import shutil shutil.copyfile(source_path, destination_path)
In this example, we use
copyfile() method from
shutil package to copy
import shutil shutil.copyfile("C:\\some_path\example_directory\example.txt", "C:\\some_path\example_directory\example_copy.txt")
If the file under
destination_pathalready exist it will be replaced.