功能:
bytes.decode() 方法以指定的编码格式解码 bytes 对象。默认编码为 'utf-8'。
语法:bytes.decode(encoding="utf-8", errors="strict")参数:
encoding -- 要使用的编码,默认为"UTF-8"。
errors -- 设置不同错误的处理方案。默认为 'strict',意为编码错误引起一个UnicodeError。 其他可能得值有 'ignore', 'replace', 'xmlcharrefreplace', 'backslashreplace' 以及通过 codecs.register_error() 注册的任何值。
返回值:返回指定的编码格式解码 bytes 对象
注意事项:1、与之相对应的是encode编码
2、字符串其余方法见:http://www.mihuguan.com/article/15703730746.html
实例说明:
>>> str="我爱我家" >>> str2=str.encode("UTF-8") >>> str2 b'\xe6\x88\x91\xe7\x88\xb1\xe6\x88\x91\xe5\xae\xb6' >>> str2.decode("UTF-8") '我爱我家' >>>
jQuery2021-01-08
jQuery2021-01-07
MySQL2020-12-13
电脑2020-12-12
服务器2020-12-06
电脑2020-10-06