Decodes S using the codec registered for encoding. encoding defaults
to the default encoding. errors may be given to set a different error
handling scheme. Default is 'strict' meaning that encoding errors raise
a UnicodeDecodeError. Other possible values are 'ignore' and 'replace'
as well as any other name registerd with codecs.register_error that is
able to handle UnicodeDecodeErrors.
按照指定的编码类型给字符串解码,解码后的编码为默认编码
errors指定处理错误的行为
如果出错了,不需要报告,设定errors ="ignore"
默认报告任何错误
errors = 'strict' , Raise UnicodeError (or a subclass); this is the default.
errors="replace" ,错误的编码用"?"替换
Encodes S using the codec registered for encoding. encoding defaults
to the default encoding. errors may be given to set a different error
handling scheme. Default is 'strict' meaning that encoding errors raise
a UnicodeEncodeError. Other possible values are 'ignore', 'replace' and
'xmlcharrefreplace' as well as any other name registered with
codecs.register_error that is able to handle UnicodeEncodeErrors.
...
errors ='xmlcharrefreplace' ,使用XML的字符引用 (only for encoding).
errors = 'backslashreplace' Replace with backslashed escape sequences (only for encoding).
Create a new Unicode object from the given encoded string.
encoding defaults to the current default string encoding.
errors can be 'strict', 'replace' or 'ignore' and defaults to 'strict'.