To write a python program for copying the contents from one file to another file.
PC Anaconda - Python 3.7
Create a text1.txt with some content in it
Open the text1.txt file in read mode
Create a copy.txt file using write mode
Copy the content of text1.txt file to copy.txt using write function
Program for copying the contents from one file to another file
Developed by: Dharshan D
Register Number: 23001663
with open("text1.txt",'r') as fp:
msg1=fp.read()
with open("copy.txt",'w') as fp1:
fp1.write(msg1)
Thus the program is written to copy the contents from one file to another file.