You need to open the file in binary mode:
file = open(fname, 'rb')
response = pickle.load(file)
file.close()
And when writing:
file = open(fname, 'wb')
pickle.dump(response, file)
file.close()
As an aside, you should use with to handle opening/closing files:
When reading:
with open(fname, 'rb') as file:
    response = pickle.load(file)
And when writing:
with open(fname, 'wb') as file:
    pickle.dump(response, file)

Fluend Python pdf download

Posted by Jeffye | 5:13 AM

Fluent Python is available for free download in PDF format

Fluent Python: Clear, Concise, and Effective Programming by Luciano Ramalho

No booshit. 
Dowload:


Popular Posts