Skip to content

Commit

Permalink
add mode of file opening
Browse files Browse the repository at this point in the history
  • Loading branch information
16ratneshkumar committed Dec 13, 2024
1 parent 08b553b commit 7809a8b
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
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

0 comments on commit 7809a8b

Please sign in to comment.