mirror of
https://github.com/python/cpython.git
synced 2025-12-08 06:10:17 +00:00
[3.14] gh-53243: Document codecs.readbuffer_encode() (GH-136284) (#136452)
gh-53243: Document `codecs.readbuffer_encode()` (GH-136284)
Closes GH-53243
(cherry picked from commit f1dcf3c7bf)
Co-authored-by: Stan Ulbrych <89152624+StanFromIreland@users.noreply.github.com>
This commit is contained in:
parent
2cb5792836
commit
85df16b7fa
1 changed files with 14 additions and 0 deletions
|
|
@ -265,6 +265,20 @@ wider range of codecs when working with binary files:
|
|||
:func:`iterencode`.
|
||||
|
||||
|
||||
.. function:: readbuffer_encode(buffer, errors=None, /)
|
||||
|
||||
Return a :class:`tuple` containing the raw bytes of *buffer*, a
|
||||
:ref:`buffer-compatible object <bufferobjects>` or :class:`str`
|
||||
(encoded to UTF-8 before processing), and their length in bytes.
|
||||
|
||||
The *errors* argument is ignored.
|
||||
|
||||
.. code-block:: pycon
|
||||
|
||||
>>> codecs.readbuffer_encode(b"Zito")
|
||||
(b'Zito', 4)
|
||||
|
||||
|
||||
The module also provides the following constants which are useful for reading
|
||||
and writing to platform dependent files:
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue