#program to copy the contents of a file to another file
import os
def filecopy(gourav,FILE2):
f1 = open(gourav, 'r')
f2 = open(FILE2, 'w')
line = [Link]()
while line != '':
[Link](line) #write the line from f1 with additional newline
line = [Link]()
[Link]()
[Link]()
def main():
fileName1= input('source file name: ')
fileName2=input('destination file name : ')
filecopy(fileName1, fileName2)
if __name__ == '__main__':
main()
#program for inserting or appending a record in a binary file student
import pickle
record = []
while True :
roll_no = int(input("enter the student roll no :"))
name = input("enter the student name")
marks = int(input("ENTER THE MARKS OBTAINED"))
DATA = [roll_no, name, marks]
choice = input("wish to enter more records (Y/N)?: ")
if [Link]() == 'N':
break
f=open("student" , "wb")
[Link](record, f)
print("record added")
[Link]
#read a record from the binaery file [Link]
import pickle
f = open("[Link]" , "rb")
stud_rec = [Link](f)
print("contents of student file are:")
#read the fields from the file
for R in stud_rec:
roll_no = R[0]
name = R[1]
marks = [2]
print(roll_no, name, marks)
[Link]