To write a python program for copying the contents from one file to another file.
PC Anaconda - Python 3.7
Open the required file by using the function "with" in read mode.
Open the another required file by using the function "with" in append mode to append.
Use for loop in file1.
Use write function.
To write the file 1 content in file 2.
End the program.
'''
DEVELOPED BY : GURUMOORTHI R
REGISTER NUMBER : 22008475
'''
with open('sample.txt','r') as file1:
with open ('san1.txt','a') as file2:
for line in file1:
file2.write(line)
Thus the program is written to copy the contents from one file to another file.