MCPcopy Create free account
hub / github.com/geekcomputers/Python / update

Function update

file_handle/File handle binary/Update a binary file2.py:15–33  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

13
14
15def update():
16 with open(student_record, "rb") as File:
17 value = pickle.load(File)
18 found = False
19 roll = int(input("Enter the roll number of the record"))
20
21 for i in value:
22 if roll == i[0]:
23 print(f"current name {i[1]}")
24 print(f"current marks {i[2]}")
25 i[1] = input("Enter the new name")
26 i[2] = int(input("Enter the new marks"))
27 found = True
28
29 if not found:
30 print("Record not found")
31
32 with open(student_record, "wb") as File:
33 pickle.dump(value, File)
34
35
36update()

Callers 1

Calls 1

loadMethod · 0.45

Tested by

no test coverage detected