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:

PHP: Loop

JavaScript: Delete duplicates in an array

Oracle: Round the number