Class 12th CBSE CS
Write a python program to write student data in a binary file.
Solution: –
import pickle s={ } file2 = open(‘student.dat’ , ‘wb’) R = int (input (“Enter roll number=“ )) N = input(“Enter name =“ ) M = float(input (“Enter marks =“ ) # add read data into dictionary S [‘Rollno’] = R S [‘Name’] = N S[‘Marks’] = M # now write into the file pickle.dump (s ,file2) file2.close( )

Fun & Easy to follow

Works on all devices

Your own Pace

Super Affordable
Popular Videos

UX for Teams
Learn the basics and a bit beyond to improve your backend dev skills.

Chris Matthews
Designer

SEO & Instagram
Learn the basics and a bit beyond to improve your backend dev skills.

Chris Matthews
Designer