https://github.com/python/cpython/commit/f22aae190800728d8c71792da17268f0f2d80ba9 commit: f22aae190800728d8c71792da17268f0f2d80ba9 branch: 3.14 author: Miss Islington (bot) <31488909+miss-isling...@users.noreply.github.com> committer: hugovk <1324225+hug...@users.noreply.github.com> date: 2025-06-13T14:46:06+03:00 summary:
[3.14] gh-106318: Add example for `str.encode()` (GH-134520) (#135457) Co-authored-by: Blaise Pabon <bla...@gmail.com> Co-authored-by: Hugo van Kemenade <1324225+hug...@users.noreply.github.com> files: M Doc/library/stdtypes.rst diff --git a/Doc/library/stdtypes.rst b/Doc/library/stdtypes.rst index b75e5ceecf874e..4854a2c077bb28 100644 --- a/Doc/library/stdtypes.rst +++ b/Doc/library/stdtypes.rst @@ -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. _______________________________________________ Python-checkins mailing list -- python-checkins@python.org To unsubscribe send an email to python-checkins-le...@python.org https://mail.python.org/mailman3//lists/python-checkins.python.org Member address: arch...@mail-archive.com