To write a python program for copying the contents from one file to another file.
PC Anaconda - Python 3.7
Step 1: Create a text file with some content in it.
Step 2: Open the created text file.
Step 3: Create another empty text file.
Step 4: Copy the content of text file to empty file using write function.
with open("nakul.txt",'r') as file1: msg=file1.read() with open("nakulnew.txt",'w') as file2: file2.write(msg)
Thus the program is written to copy the contents from one file to another file.