Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@

def bdelete():
# Opening a file & loading it
with open("studrec.dat") as F:
with open("studrec.dat","rb") as F:
stud = pickle.load(F)
print(stud)

# Deleting the Roll no. entered by user
rno = int(input("Enter the Roll no. to be deleted: "))
with open("studrec.dat") as F:
with open("studrec.dat","wb") as F:
rec = [i for i in stud if i[0] != rno]
pickle.dump(rec, F)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@


def binary_read():
with open("studrec.dat") as b:
with open("studrec.dat","rb") as b:
stud = pickle.load(b)
print(stud)

Expand Down
Loading