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')

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



Join our Question Answer community to learn and share your programming knowledge.

Help the community:

Python: Fizzbuzz

C++: Decimal to binary conversion

JavaScript: Need Help in JavaScript

Python: Help me with this program