shutil module contains many functions but two of them can be used to copy files from one location to another. To demonstrate this I created two text files named
You can copy the content of the
file1.txt to the
file2.txt. This way, both files will have the same content but they will still have their original names.
>>> import shutil
>>> new_file_path = shutil.copy('file1.txt', 'file2.txt')