To write a python program for copying the contents from one file to another file.
PC Anaconda - Python 3.7
Import numpy as np
Enter the input values
write a python program for copying the contents from one file to another file.
run the program
give the input file name
end the program
# developed by: HEMA LOKITHA P
# reg no:23007550
def copy(fname,newfile):
with open (fname,'r') as f1:
with open(newfile,'a') as f2:
data1=f1.read()
f2.write(data1)
fname=input("enter existing file name")
newfile=input("enter new file name")
copy(fname,newfile)
Thus the program is written to copy the contents from one file to another file.