To write a python program for copying the contents from one file to another file.
PC Anaconda - Python 3.7
First we need to open the required file form which we need to copy the text.
Again using the with keyword to open the empty file.
Using keyword "with" to open the requied file.
Again using the with keyword to open the empty file.
The empty file is open by using 'W' which is used to write only.
The four function is used to take each line from the main file.
#Developed by : Prashanth.K
#Register No : 212223230152
with open ("text.txt") as fp:
with open("file.txt","w") as fp1:
line= fp.read()
fp1.write(line)
Thus the program is written to copy the contents from one file to another file.