MCPcopy Index your code
hub / github.com/geekcomputers/Python / b_modify

Function b_modify

file_handle/File handle binary/delete.py:28–40  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

26
27
28def b_modify():
29 # Deleting the Roll no. entered by user
30 if not os.path.exists(student_record):
31 logging.warning("File not found")
32 return
33 roll_no = int(input("Enter the Roll No. to be deleted: "))
34 student = 0
35 with open(student_record, "rb") as F:
36 student = pickle.load(F)
37
38 with open(student_record, "wb") as F:
39 rec = [i for i in student if i[0] != roll_no]
40 pickle.dump(rec, F)
41
42
43b_read()

Callers 1

delete.pyFile · 0.70

Calls 2

warningMethod · 0.80
loadMethod · 0.45

Tested by

no test coverage detected