1.

Which of the following statement opens a binary file record.bin in write mode and writes data from a list lst1 = [1,2,3,4] on the binary file? a. with open('record.bin','wb') as myfile:pickle.dump(lst1,myfile) b. with open('record.bin','wb') as myfile: pickle.dump(myfile,lst1)c. with open('record.bin','wb+') as myfile: pickle.dump(myfile,lst1) d. with open('record.bin','ab') as myfile: pickle.dump(myfile,lst1)

Answer»

a. with open('record.bin','wb') as myfile:

pickle.dump(lst1,myfile)



Discussion

No Comment Found

Related InterviewSolutions