I am storing the records in form of a list.
Write a menu driven program to append, display and delete student details [id, name, percentage] in a binary file. Deletion should be done on the basis of student id.
So I wrote this:
#Code to append display and delete student details
import pickle
def append():
    f = open("student.bin","ab")
    x = int(input("Enter number of students to be appended: "))
    for i in range(x):
        y = eval(input("Enter details in the form [id, name, percentage]: "))
        pickle.dump(y,f)
    f.close()
def display():
    f = open("student.bin","rb")
    while True:
        try:
            x = pickle.load(f)
            print(x)
        except EOFError:
            break
    f.close()
def delete():
    f = open("student.bin","ab+")
    x = input("Enter id to be deleted: ")
    y = pickle.load(f)
    for i in y:
        if str(i[0]) == str(x):
In the end, I was matching the user input to the matching IDs but I don't know how I should go about deleting the list entirely from the binary file.
 
     
    