diff options
author | Georg Brandl <georg@python.org> | 2009-05-04 21:01:20 (GMT) |
---|---|---|
committer | Georg Brandl <georg@python.org> | 2009-05-04 21:01:20 (GMT) |
commit | 4f5f98d7d122d5d5fe17d97ac61b288abb45a5fc (patch) | |
tree | 7821235028eb161ea76d7e2f0746790113e254fc /Doc/library | |
parent | 5f25972a0550e6754407652ab3818f6aaf11a965 (diff) | |
download | cpython-4f5f98d7d122d5d5fe17d97ac61b288abb45a5fc.zip cpython-4f5f98d7d122d5d5fe17d97ac61b288abb45a5fc.tar.gz cpython-4f5f98d7d122d5d5fe17d97ac61b288abb45a5fc.tar.bz2 |
Add missing documentation for bytes.decode().
Diffstat (limited to 'Doc/library')
-rw-r--r-- | Doc/library/stdtypes.rst | 28 |
1 files changed, 20 insertions, 8 deletions
diff --git a/Doc/library/stdtypes.rst b/Doc/library/stdtypes.rst index c8c2c80..fc77adc 100644 --- a/Doc/library/stdtypes.rst +++ b/Doc/library/stdtypes.rst @@ -800,14 +800,14 @@ functions based on regular expressions. .. method:: str.encode([encoding[, errors]]) - Return an encoded version of the string. Default encoding is the current - default string encoding. *errors* may be given to set a different error - handling scheme. The default for *errors* is ``'strict'``, meaning that - encoding errors raise a :exc:`UnicodeError`. Other possible values are - ``'ignore'``, ``'replace'``, ``'xmlcharrefreplace'``, ``'backslashreplace'`` and - any other name registered via :func:`codecs.register_error`, see section - :ref:`codec-base-classes`. For a list of possible encodings, see section - :ref:`standard-encodings`. + Return an encoded version of the string as a bytes object. Default encoding + is the current default string encoding. *errors* may be given to set a + different error handling scheme. The default for *errors* is ``'strict'``, + meaning that encoding errors raise a :exc:`UnicodeError`. Other possible + values are ``'ignore'``, ``'replace'``, ``'xmlcharrefreplace'``, + ``'backslashreplace'`` and any other name registered via + :func:`codecs.register_error`, see section :ref:`codec-base-classes`. For a + list of possible encodings, see section :ref:`standard-encodings`. .. method:: str.endswith(suffix[, start[, end]]) @@ -1512,6 +1512,18 @@ Wherever one of these methods needs to interpret the bytes as characters b = a.replace(b"a", b"f") +.. method:: bytes.decode([encoding[, errors]]) + bytearray.decode([encoding[, errors]]) + + Return a string decoded from the given bytes. Default encoding is the + current default string encoding. *errors* may be given to set a different + error handling scheme. The default for *errors* is ``'strict'``, meaning + that encoding errors raise a :exc:`UnicodeError`. Other possible values are + ``'ignore'``, ``'replace'`` and any other name registered via + :func:`codecs.register_error`, see section :ref:`codec-base-classes`. For a + list of possible encodings, see section :ref:`standard-encodings`. + + The bytes and bytearray types have an additional class method: .. classmethod:: bytes.fromhex(string) |