0% found this document useful (0 votes)
5 views3 pages

Student Management System with Binary Files

The document outlines a Python program for a Student Management System that uses binary files to store student records. It includes functions to write, display, search, update, and delete student data based on roll number, name, and marks. The program features a main menu for user interaction and utilizes the pickle module for data serialization.

Uploaded by

booklove.girl19
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
5 views3 pages

Student Management System with Binary Files

The document outlines a Python program for a Student Management System that uses binary files to store student records. It includes functions to write, display, search, update, and delete student data based on roll number, name, and marks. The program features a main menu for user interaction and utilizes the pickle module for data serialization.

Uploaded by

booklove.girl19
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd

#BINARY FILES USING LIST

#STUDENT MANAGEMENT SYSTEM


import pickle
def write():
f=open("[Link]","wb")
record=[]
while True:
rno=int(input("Enter rollno"))
name=input("enter name")
marks=int(input("Enter marks"))
data=[rno,name,marks]
[Link](data)
ch=input("do you want to enter more records Y/N")
if ch in 'Nn':
break
[Link](record,f)
print("RECORDS ADDED")
[Link]()
def display():
print("..DISPLAY CONTENTS OF A FILE.......")
f=open("[Link]","rb")
stulist=[Link](f)
print(stulist)
[Link]()
def searchrno():
f=open('[Link]','rb')
stulist=[Link](f)
[Link]()
r=int(input("enter roll to search"))
for stu in stulist:
if r==stu[0]:
print(stu)
def searchname():
f=open('[Link]','rb')
stulist=[Link](f)
[Link]()
n=input("enter name to search")
for stu in stulist:
if n==stu[1]:
print(stu)
def searchmarks():
f=open('[Link]','rb')
stulist=[Link](f)
[Link]()
m=int(input("enter marks to search"))
for stu in stulist:
if m==stu[2]:
print(stu)
def searchmark():
f=open('[Link]','rb')
stulist=[Link](f)
[Link]()
for stu in stulist:
if stu[2]>90:
print(stu)

def updateone():
f=open("[Link]","rb+")
r=int(input("enter roll to update"))
[Link](0)
try:
while True:
rpos=[Link]()
s=[Link](f)
print(s)
for i in s:
if i[0]==r:
i[1]=input("new name")
i[2]=int(input("updated marks"))
[Link](rpos)
[Link](s,f)
break

except Exception:
[Link]()
def updateall():
pass
def delete():
f=open('[Link]','rb')
stulist=[Link](f)
[Link]()
r=int(input("enter roll to delete"))
for stu in stulist:
if r==stu[0]:
[Link](stu)
print("record deleted")
break
else:
print("record not found")
return
f=open('[Link]','wb')
[Link](stulist,f)
[Link]()
def append():
pass

def MainMenu():
print("*******************")
print("------------------MENU---------------------")
print("1-WRITE DATA IN A BINARY FILE ")
print("2-DISPLAY ALL DATA OF A BINARY FILE")
print("3-SEARCH DATA IN A BINARY FILE WITH ROLLNO ")
print("4-SEARCH DATA IN A BINARY FILE WITH NAME ")
print("5-SEARCH DATA IN A BINARY FILE WITH MARKS ")
print("6-UPDATE ONE DATA IN A BINARY FILE ")
print("7-UPDATE ALL DATA IN A BINARY FILE ")
print("8-DELETE DATA IN A BINARY FILE ")
print("9-APPEND DATA IN A BINARY FILE ")
print("10-SEARCH DATA IN A BINARY FILE WITH MARKS >90")
print("11--------EXIT-----------")
print("********************")
#main program
while True:
MainMenu()
ch=int(input("Enter your choice"))
if ch==1:
write()
if ch==2:
display()
if ch==3:
searchrno()
if ch==4:
searchname()
if ch==5:
searchmarks()
if ch==6:
updateone()
if ch==7:
updateall()
if ch==8:
delete()
if ch==9:
append()
if ch==10:
searchmark()
if ch==11:
print("HAVE A NICE DAY")
[Link]()

You might also like