no_of_students=int(input("Enter no of students: ")) file=open("student0.dat","ab") for i in range(no_of_students): student_data["RollNo"]=int(input("Enter roll no: ")) student_data["Name"]=input("Enter Student name: ") student_data["Marks"]=float(input("Enter Student Marks: ")) pickle.dump(student_data,file) student_data={} file.close() file=open("student0.dat","rb") try: while True: student_data=pickle.load(file) print(student_data) except EOFError: file.close()
found=False roll_no=int(input("enter the roll no to search: ")) file=open("student0.dat","rb+") try: while True: pos=file.tell() student_data=pickle.load(file) if(student_data["RollNo"])==roll_no: student_data["Marks"]=float(input("Enter marks to be updated: ")) file.seek(pos) pickle.dump(student_data,file) found=True except EOFError: if(found==False): print("Roll no not found Please Try Again") else: print("Student marks updated successfully") file.close()
file=open("student0.dat","rb") try: while True: student_data=pickle.load(file) print(student_data) except EOFError: file.close()
no_of_students=int(input("Enter no of students: ")) file=open("student0.dat","ab") for i in range(no_of_students): student_data["RollNo"]=int(input("Enter roll no: ")) student_data["Name"]=input("Enter Student name: ") student_data["Marks"]=float(input("Enter Student Marks: ")) pickle.dump(student_data,file) student_data={} file.close() file=open("student0.dat","rb") try: while True: student_data=pickle.load(file) print(student_data) except EOFError: file.close()
found=False roll_no=int(input("enter the roll no to search: ")) file=open("student0.dat","rb+") try: while True: pos=file.tell() student_data=pickle.load(file) if(student_data["RollNo"])==roll_no: student_data["Marks"]=float(input("Enter marks to be updated: ")) file.seek(pos) pickle.dump(student_data,file) found=True except EOFError: if(found==False): print("Roll no not found Please Try Again") else: print("Student marks updated successfully") file.close()
file=open("student0.dat","rb") try: while True: student_data=pickle.load(file) print(student_data) except EOFError: file.close()
its very useful
ReplyDeleteIt's very helpful and good👍👍
ReplyDeleteThanks a lot... You don't know how much you people have helped me❤️❤️
ReplyDeletehow much ? 😂
Deleteabe bhai paper dele pehle flirt baad mein kr liyo
Deletebete mauj krdi
Deletesala launda nikla to?
Deleteplease sir iska sorce code dedo yaha par copy karna hau?
ReplyDeleteimport pickle
Deletestudent_data={}
no_of_students=int(input("Enter no of students: "))
file=open("student0.dat","ab")
for i in range(no_of_students):
student_data["RollNo"]=int(input("Enter roll no: "))
student_data["Name"]=input("Enter Student name: ")
student_data["Marks"]=float(input("Enter Student Marks: "))
pickle.dump(student_data,file)
student_data={}
file.close()
file=open("student0.dat","rb")
try:
while True:
student_data=pickle.load(file)
print(student_data)
except EOFError:
file.close()
found=False
roll_no=int(input("enter the roll no to search: "))
file=open("student0.dat","rb+")
try:
while True:
pos=file.tell()
student_data=pickle.load(file)
if(student_data["RollNo"])==roll_no:
student_data["Marks"]=float(input("Enter marks to be updated: "))
file.seek(pos)
pickle.dump(student_data,file)
found=True
except EOFError:
if(found==False):
print("Roll no not found Please Try Again")
else:
print("Student marks updated successfully")
file.close()
file=open("student0.dat","rb")
try:
while True:
student_data=pickle.load(file)
print(student_data)
except EOFError:
file.close()
This helped me understand the logic behind...Thank You!!!
ReplyDeleteIt is very helpful for us
ReplyDeleteThank you soooo muchhhhh....
ReplyDeleteSirif mai hii hua kya jo practicals complete karne yaha aaya hai?
ReplyDeletenahi bhai akela mat samjo apne app ko
Deleteimport pickle
ReplyDeletestudent_data={}
no_of_students=int(input("Enter no of students: "))
file=open("student0.dat","ab")
for i in range(no_of_students):
student_data["RollNo"]=int(input("Enter roll no: "))
student_data["Name"]=input("Enter Student name: ")
student_data["Marks"]=float(input("Enter Student Marks: "))
pickle.dump(student_data,file)
student_data={}
file.close()
file=open("student0.dat","rb")
try:
while True:
student_data=pickle.load(file)
print(student_data)
except EOFError:
file.close()
found=False
roll_no=int(input("enter the roll no to search: "))
file=open("student0.dat","rb+")
try:
while True:
pos=file.tell()
student_data=pickle.load(file)
if(student_data["RollNo"])==roll_no:
student_data["Marks"]=float(input("Enter marks to be updated: "))
file.seek(pos)
pickle.dump(student_data,file)
found=True
except EOFError:
if(found==False):
print("Roll no not found Please Try Again")
else:
print("Student marks updated successfully")
file.close()
file=open("student0.dat","rb")
try:
while True:
student_data=pickle.load(file)
print(student_data)
except EOFError:
file.close()
While running the program I am getting typeerror tuple object does not support item assignment.
ReplyDeleteSo please can you help me out to run this properly