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

Write: Open Int Input Input Input Dump Input

The document contains a Python script that allows users to write movie data to a binary file using pickle, read the data back, and search for movies of a specific type (comedy) to copy them to a new file. The Write function collects movie details and stores them, while the Read function retrieves and displays the stored data. The Search_Copy function filters comedy movies from the original file and saves them to a new file, then displays the contents of both files.

Uploaded by

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

Write: Open Int Input Input Input Dump Input

The document contains a Python script that allows users to write movie data to a binary file using pickle, read the data back, and search for movies of a specific type (comedy) to copy them to a new file. The Write function collects movie details and stores them, while the Read function retrieves and displays the stored data. The Search_Copy function filters comedy movies from the original file and saves them to a new file, then displays the contents of both files.

Uploaded by

Arceus Gaming
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 3

import pickle

def Write():
File=open("BiFi.dat",'wb')
while True:
Mno=int(input("Enter Mno"))
Mname=input("Movie Name")
MType=input("Enter Movie Type")
List=[Mno,Mname,MType]
pickle.dump(List,File)
ch=input("Enter Y or y for more Data Updation")
if ch not in "Yy":
break
def Read(f):
File=open(f,'rb')
try:
while True:
Data=pickle.load(File)
print(Data)
except:
File.close()

def Search_Copy():
File1=open("BiFi.dat",'rb')
File2=open("Joy.dat",'wb')
try:
while True:
Data=pickle.load(File1)
if Data[2].lower()=='comedy':
pickle.dump(Data,File2)
except:
File1.close()
File2.close()
print("File No 1 - ")
print("*"*20)
Read("BiFi.dat")
print("File No 2 - ")
print("*"*20)
Read("Joy.dat")
Search_Copy()

You might also like