编码与解码:
用到的库codecs
例子:
>>>raw_string = codecs.encode("我能吞下玻璃而不伤害身体", "gb2312")
>>> raw_string
>>>b'\xce\xd2\xc4\xdc\xcd\xcc\xcf\xc2\xb2\xa3\xc1\xa7\xb6\xf8\xb2\xbb\xc9\xcb\xba\xa6\xc9\xed\xcc\xe5'
>>> unicode_string = codecs.decode(raw_string, "gb2312")
>>> unicode_string
>>>'我能吞下玻璃而不伤害身体'