create a binary file "employee",that stores the records of employees and display the content. records of employee will be list type. write a python program
Answers
Answered by
16
Answer:
#It creates a file called emp.dat and stores data
import pickle
emp={'Namita':25000,'Manya':30000,'Tanu':20000}
f1=open('emp.dat','wb')
pickle.dump(emp,f1)
f1.close()
Output:
A file named emp.dat will be created in current working directory.
#It displays the data from emp.dat
import pickel
f1=open('emp.dat','rb')
e=pickle.load(f1)
for x in e:
print(x)
f1.close()
Similar questions