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 which we need to copy the test.
Using keyword "with" to open the required file.
Again using the width keyword to open the empty file.
The empty file is open by using "w" which is used to write only
The for function is used to take each line from the main file.
Write() is used to write the linesof main file to the empty file or do the directed file.
with open("file1.txt","r") as fp:
V = fp.read()
print(V)
Thus the program is written to copy the contents from one file to another file.