mirror of
https://github.com/python/cpython.git
synced 2026-04-01 17:41:27 +00:00
gh-106318: Add example for str.encode() (#134520)
Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>
This commit is contained in:
parent
747d390045
commit
273459562e
1 changed files with 8 additions and 0 deletions
|
|
@ -1841,6 +1841,14 @@ expression support in the :mod:`re` module).
|
|||
unless an encoding error actually occurs,
|
||||
:ref:`devmode` is enabled
|
||||
or a :ref:`debug build <debug-build>` is used.
|
||||
For example::
|
||||
|
||||
>>> encoded_str_to_bytes = 'Python'.encode()
|
||||
>>> type(encoded_str_to_bytes)
|
||||
<class 'bytes'>
|
||||
>>> encoded_str_to_bytes
|
||||
b'Python'
|
||||
|
||||
|
||||
.. versionchanged:: 3.1
|
||||
Added support for keyword arguments.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue