Python's string.translate() doesn't fully work?
Posted
by Rhubarb
on Stack Overflow
See other posts from Stack Overflow
or by Rhubarb
Published on 2010-06-10T23:59:15Z
Indexed on
2010/06/11
0:02 UTC
Read the original article
Hit count: 208
Given this example, I get the error that follows:
print u'\2033'.translate({2033:u'd'})
C:\Python26\lib\encodings\cp437.pyc in encode(self, input, errors)
10
11 def encode(self,input,errors='strict'):
---> 12 return codecs.charmap_encode(input,errors,encoding_map)
13
14 def decode(self,input,errors='strict'):
UnicodeEncodeError: 'charmap' codec can't encode character u'\x83' in position 0
© Stack Overflow or respective owner