To write a python program for copying the contents from one file to another file.
PC Anaconda - Python 3.7
Step 1: Create a text1.txt with some content in it
Step 2: Open the text1.txt file in read mode
Step 3: Create a copy.txt file using write mode
Step 4: Copy the content of text1.txt file to copy.txt using write function
Program for copying the contents from one file to another file
Programmed By: SANJAY T
RegisterNumber: 212222110039
with open("text1.txt",'r') as fp:
msg1=fp.read()
with open("copytxt",'w') as fp1:
fp1.write(msg1)
Thus the program is written to copy the contents from one file to another file.