Computer Science, asked by harinisalwaal, 6 months ago

write a python script to read the data from binary file "players.dat" having information [code, name, total runs and country]​

Answers

Answered by allysia
3

Answer:

Python

Porgram:

import pickle

file=open('players.dat','rb')

read=pickle.load(f)

for data_list in read:

        print(data_list)

file.close()

Explanations:

  • pickle module performs functions on binary file.
  • load method is used to get the file data into a reader object which can be further read with a loop.
  • close() function closes the file after performing the function.
Similar questions