Binary File Record Searching and Counting in Python | Python Binary File Searching Record | CS 083

Veröffentlicht am: 27 Mai 2024
auf dem Kanal: Anjeev Singh
323
5

In this video, you will learn about binary file record searching and counting records that satisfy Python's specific conditions. Python Binary file handling, File Handling in Python,
File Name: telephone.dat
Record Structure: cid, name, mobileNo
Write a function to read a binary file and display those records which
contains 98 in their mobile number anywhere.
Display the number of records also.


import pickle

def readTelephone():
fobj = open("telephone.dat", "rb")

found = False
count = 0
try:
while True:
rec = pickle.load(fobj)
if '98' in rec['mobileno']: # if '98' in rec[2]
print(rec['cid'], rec['name'], rec['mobileno'])
found = True
count += 1
except:
fobj.close()
if found == True:
print("Found Records")
print(count, "records found")
else:
print("Not found any record")


Auf dieser Seite können Sie das Online-Video Binary File Record Searching and Counting in Python | Python Binary File Searching Record | CS 083 mit der Dauer stunde minuten sekunde in guter Qualität ansehen, das der Benutzer Anjeev Singh 27 Mai 2024 hochgeladen hat, den Link mit Freunden und Bekannten teilen, dieses Video wurde auf Youtube bereits 323 Mal angesehen und es wurde von 5 den Zuschauern gefallen. Viel Spaß beim Betrachtenden Zuschauern gefallen!