To write a python program for copying the contents from one file to another file.
PC Anaconda - Python 3.7
Use open function to open the file in which we want to copy from and access it in read mode
Read the file and store in a variable
Now create a new file in which we want to paste the content using write access mode
Now create a new file in which we want to paste the content using write access mode
The content in the original file will be copied in the new file
The END.
#Program to copy the contents from one file to another file
#Developed by: Gautham M G
#Register number: 212221230027
with open("lose.txt","r") as fp:
copy=fp.read()
with open("copy.txt","w") as cp:
cp.write(copy)
Thus the program is written to copy the contents from one file to another file.