Q. Identify the error in the following code.


import pickle

data = ['one', 2, [3, 4, 5]]

with open('data.dat', 'wb':

          pickle. dump(data)


Answer =

Error in line 3 that is open () function should be close like (open()) and also there is not present file handle.
Error in Line 4 that is file handle is not present in dump() function.

Post a Comment

You can help us by Clicking on ads. ^_^
Please do not send spam comment : )

Previous Post Next Post