python3 str.encode bytes.decode
2017-08-30 11:24
405 查看
str.encode
把字符串编码成字节序列
bytes.decode
把字节序列解码成字符串
https://docs.python.org/3.5/library/stdtypes.html
Return an encoded version of the string as a bytes object. Default encoding is
Changed in version 3.1: Support for keyword arguments added.
Return a string decoded from the given bytes. Default encoding is
Note
Passing the encoding argument to
Changed in version 3.1: Added support for keyword arguments.
把字符串编码成字节序列
bytes.decode
把字节序列解码成字符串
https://docs.python.org/3.5/library/stdtypes.html
str.
encode(encoding=”utf-8”, errors=”strict”)
Return an encoded version of the string as a bytes object. Default encoding is
'utf-8'. errors may be given to set a different error handling scheme. The default for errors is
'strict', meaning that encoding errors raise a
UnicodeError. Other possible values are
'ignore',
'replace',
'xmlcharrefreplace',
'backslashreplace'and any other name registered via
codecs.register_error(), see section Error Handlers. For a list of possible encodings, see section Standard Encodings.
Changed in version 3.1: Support for keyword arguments added.
bytes.
decode(encoding=”utf-8”, errors=”strict”)
bytearray.
decode(encoding=”utf-8”, errors=”strict”)
Return a string decoded from the given bytes. Default encoding is
'utf-8'. errors may be given to set a different error handling scheme. The default for errors is
'strict', meaning that encoding errors raise a
UnicodeError. Other possible values are
'ignore',
'replace'and any other name registered via
codecs.register_error(), see section Error Handlers. For a list of possible encodings, see section Standard Encodings.
Note
Passing the encoding argument to
strallows decoding any bytes-like object directly, without needing to make a temporary bytes or bytearray object.
Changed in version 3.1: Added support for keyword arguments.
相关文章推荐
- python3中bytes和str,encode和decode的区别
- python的str,unicode对象的encode和decode方法, Python中字符编码的总结和对比bytes和str
- python的str,unicode对象的encode和decode方法, Python中字符编码的总结和对比bytes和str
- python3 unicode bytes decode encode之间联系
- python的str,unicode对象的encode和decode方法(转)
- python的str,unicode对象的encode和decode方法(转)
- 转:python的str,unicode对象的encode和decode方法
- python的str,unicode对象的encode和decode方法
- python的str,unicode对象的encode和decode方法
- python的str,unicode对象的encode和decode方法
- python的str,unicode对象的encode和decode方法
- python的str,unicode对象的encode和decode方法(转)
- python蛋疼的编码decode、encode、unicode、str、byte的问题都在这了
- python 字符串编码 str和unicode 区别以及相互转化 decode('utf-8') encode('utf-8')
- python的str,unicode对象的encode和decode方法
- bytes与str(encode,decode)
- python的str,unicode对象的encode和decode方法
- python中decode和encode
- Python字符串的encode与decode研究心得——解决乱码问题
- python decode-encode