I work with a large set of text files. Many of them are written in different encodings. I am creating a list of objects that contains some substrings from these text files. I deal with coding issues when opening files (objects are created correctly and can be used). Here is my list:
len(hands)
47580
type(hands)
<class 'list'>
type(hands[0])
<class '__main__.BridgeHand'>
Now I am trying to sort this object:
import pickle
pickle.dump(hands, open("handspi.p", "wb"))
It creates a 9MB filepi file. Problems arise when I try to decompose it:
hh = pickle.load(open(
The stack trace ends:
File "C:\Python31\lib\encodings\cp1252.py", line 23, in decode
return codecs.charmap_decode(input,self.errors,decoding_table)[0]
UnicodeDecodeError: 'charmap' codec can't decode byte 0x81 in position 30: character maps to <undefined>
What should I do? Thanks for the help:)
source
share