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 form which we need to copy the text.Again using the with keyword to open the empty file.
Using keyword "with" to open the requied file.
Again using the with keyword to open the empty file.
The empty file is open by using 'W' which is used to write only.
The four function is used to take each line from the main file.
The four function is used to take each line from the main file.
'''
Program for copying the contents from one file to another file.
Developed by: hanumanth
#RegisterNumber:22005234
'''
with open("git.txt","r") as f1:
with open("MyFile.txt","a") as f2:
for line in f1:
f2.write(line)
Thus the program is written to copy the contents from one file to another file.