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

Function update

1 File handle/File handle binary/update2.py:12–29  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

10
11
12def update():
13 with open(student_record, "rb") as F:
14 S = pickle.load(F)
15 found = False
16 rno = int(input("enter the roll number you want to update"))
17
18 for i in S:
19 if rno == i[0]:
20 print(f"the current name is {i[1]}")
21 i[1] = input("enter the new name")
22 found = True
23 break
24
25 if found:
26 print("Record not found")
27
28 with open(student_record, "wb") as F:
29 pickle.dump(S, F)
30
31
32update()

Callers 1

update2.pyFile · 0.70

Calls 1

loadMethod · 0.45

Tested by

no test coverage detected