Documenti di Didattica
Documenti di Professioni
Documenti di Cultura
6)
Write a function in Python to search for BookNo from a binary file BOOK.DAT, assuming the
binary file is contained the objects of the class BOOK with attributes Bno and Title:
Write another function in Python to modify a book, where the object is sent to the function
as an argument
7)
Write a function to search and display all flights whose destination is Mumbai from the binary file
Flights.dat. Assuming the binary file is containing the objects of the following class.
class Flight:
def __init__(self):
self.fno=570
self.To=Mumbai
self.From=Dubai
def enter(self):
self.no,self.To,self.From=raw_input(Enter no,To and From:)
def display(self):
print self.no,self.To,self.From
8) Given a binary file PHONE.DAT, containing records of the following structure type
class Phonlist (Name, Address,AreaCode, PhoneNo)
Write a function TRANSFER ( ) in Python that would copy all those records which are having
AreaCode as DEL from PHONE.DAT to PHONBACK.DAT.
9) Assuming the class ANTIQUE as declared below, write a function in python to read the
objects of ANTIQUE from binary file ANTIQUE.DAT and display those antique items, which
are priced between 10000 and 15000.
class ANTIQUE:
def __init__(self):
self.Ano=1
self.Aname=
self.price=0.0
10) Write a function in Python to read and display the records of candidate ( Id, votes) of those
candidates who have scored more than 1000 votes from a binary file election.dat.
Assuming that this binary file contains records/objects of class Candidate. Note: If none of
the candidates scored more than 1000, display appropriate message.