w3resource logo
Python Exercises

Python File I/O: Copy the contents of a file to another file

Python File I/O: Exercise-13 with Solution

Write a Python program to copy the contents of a file to another file .

Sample Solution:-

Python Code:

from shutil import copyfile
copyfile('test.py', 'abc.py')

Sample Output:

abc.py

Python Code Editor:

from shutil import copyfile
copyfile('test.py', 'abc.py')

Improve this sample solution and post your code through Disqus