1,attributeerror: ' str ' object has no attribute ' decode ',:
Decode encode
bytes------> str (Unicode)------>bytes
Decode's target is dying bytes!
2,unicodedecodeerror: ' Utf-8 ' codec can ' t decode byte 0xb7 in position 0:invalid start byte
Often see this: \xb7\xfb\xe5\xab
>>> a= ' Fu Yi '
>>> a.encode (' gb2312 ')
B ' \xb7\xfb\xe5\xab '
>>> a.encode (' Utf-8 ')
B ' \xe7\xac\xa6\xe7\x80\x9a '
This shows Utf-8 and gb2312 to compile Chinese is similar to the beginning of "\x".
This error is using encoding decoding is not correct, you can try to use gb2312 to decode.
3. "\u65e0\u6cd5\u901a\u8fc7\u626b\u7801\u627e\u5230"
Syntaxerror:eol while scanning string literal quotation marks wrong in Chinese ...
This is the Unicode format, win under do not know why is not normal, normal to B = A.encode (' Utf-8 '). Decode (' Utf-8 ').
Python Coding problem Record