☺:
>>> bytes('☺','ibm437')
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/lib/python3.3/encodings/cp437.py", line 12, in encode
return codecs.charmap_encode(input,errors,encoding_map)
UnicodeEncodeError: 'charmap' codec can't encode character '\u263a' in position 0: character maps to <undefined>
与 é 相反,它有效:
>>> bytes('é','ibm437')
b'\x82'
我希望☺能把我带回来b'\x01'
。我怎样才能做到这一点?