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 from one file to another file.
Using key word "with" to open the required 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 for fuction is used to take the each linefrom the main file.
Write() is used to write the linesof main file to the empty file ordothe directed file.
''' Developed By Nme:S.Meena, Ref No:21500895 '''
with open("file1.txt","r") as fp:
with open("file2.txt",""w") as fp1:
v = fp.read()
fp1.write(v)
Thus the program is written to copy the contents from one file to another file.