To write a python program for copying the contents from one file to another file.
PC Anaconda - Python 3.7
Create a file
Write some lines in that file.
Create a python file.
Write a code to copy the content of the file to a new file
Run the program
Display the output.
Developed by:Harrish Venkat V
Register No.:23013973
def copy(filename,newfile):
with open(filename,'r') as fp:
with open(newfile,'w') as fp1:
data1=fp.read()
fp1.write(data1)
filename=input("Enter an Existing File:")
newfile=input("Enter a name for new file:")
copy(filename,newfile)
Thus the program is written to copy the contents from one file to another file.