Computer Science, asked by Sonu7016, 8 months ago

Create a binary file with role no,name and marks. input a role number and update the marks

Answers

Answered by amuthamcablevkl
73

Answer:

def insertRec():

   rollno = int(input('Enter roll number:'))

   name = input('Enter Name:')

   marks = int(input('Enter Marks'))

rec = {'Rollno':rollno,'Name':name,'Marks':marks

f = open('student.dat','ab')

   pickle.dump(rec,f)

   f.close()

Explanation:

mark me brainest

Answered by shilpa85475
6

def insertRec():

 rollno = int(input('Enter roll number:'))

 name = input('Enter Name:')

marks = int(input('Enter Marks'))

rec = {'Rollno':rollno,'Name':name,'Marks':marks

f = open('student.dat','ab')

pickle.dump(rec,f)

f.close()

Explanation:

Binary files generally make use of strings of type bytes.

When one is reading binary data from a file, an object of type bytes is returned.

The binary file is opened using the open() function, whose mode parameter contains the character 'b'.

A binary file is a file that content must be interpreted by a program or a hardware processor.

The executable or ready to run programs are often identified as binary files and given a file name extension of ".bin"

Similar questions