Python 编码

decode() : 从指定编码方式解码为unicode方式
eg: bytes.decode(encoding="utf-8", errors="strict")

  • encoding : 要使用的编码
  • errors : 设置不同错误的处理方案。默认为 'strict',意为编码错误引起一个UnicodeError。 其他可能得值有 'ignore', 'replace', 'xmlcharrefreplace', 'backslashreplace' 以及通过 codecs.register_error() 注册的任何值。

encode() : 从unicode编码为指定编码方式
eg: str.encode(encoding='UTF-8',errors='strict')

  • 参数同上

你可能感兴趣的:(Python 编码)