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