diff options
| author | Thomas Wouters <thomas@python.org> | 2025-08-06 13:05:02 (GMT) |
|---|---|---|
| committer | Thomas Wouters <thomas@python.org> | 2025-08-06 13:05:20 (GMT) |
| commit | 4e665351082c50018fb31d80db25b4693057393e (patch) | |
| tree | 2454a2c3b5ee75c05d4b0423b05443a3faa4da94 /Lib | |
| parent | 5c5574bfeb2d21813d371b6b8456438bdb63d74b (diff) | |
| download | cpython-3.13.6.zip cpython-3.13.6.tar.gz cpython-3.13.6.tar.bz2 | |
Python 3.13.6v3.13.6
Diffstat (limited to 'Lib')
| -rw-r--r-- | Lib/pydoc_data/topics.py | 44 |
1 files changed, 35 insertions, 9 deletions
diff --git a/Lib/pydoc_data/topics.py b/Lib/pydoc_data/topics.py index e807ea9..b5a9148 100644 --- a/Lib/pydoc_data/topics.py +++ b/Lib/pydoc_data/topics.py @@ -1,4 +1,4 @@ -# Autogenerated by Sphinx on Wed Jun 11 17:36:53 2025 +# Autogenerated by Sphinx on Wed Aug 6 15:05:15 2025 # as part of the release process. topics = { @@ -9055,7 +9055,13 @@ str.encode(encoding='utf-8', errors='strict') For performance reasons, the value of *errors* is not checked for validity unless an encoding error actually occurs, Python - Development Mode is enabled or a debug build is used. + Development Mode is enabled or a 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' Changed in version 3.1: Added support for keyword arguments. @@ -9068,6 +9074,19 @@ str.endswith(suffix[, start[, end]]) otherwise return "False". *suffix* can also be a tuple of suffixes to look for. With optional *start*, test beginning at that position. With optional *end*, stop comparing at that position. + Using *start* and *end* is equivalent to + "str[start:end].endswith(suffix)". For example: + + >>> 'Python'.endswith('on') + True + >>> 'a tuple of suffixes'.endswith(('at', 'in')) + False + >>> 'a tuple of suffixes'.endswith(('at', 'es')) + True + >>> 'Python is amazing'.endswith('is', 0, 9) + True + + See also "startswith()" and "removesuffix()". str.expandtabs(tabsize=8) @@ -9083,12 +9102,15 @@ str.expandtabs(tabsize=8) ("\n") or return ("\r"), it is copied and the current column is reset to zero. Any other character is copied unchanged and the current column is incremented by one regardless of how the - character is represented when printed. + character is represented when printed. For example: - >>> '01\t012\t0123\t01234'.expandtabs() - '01 012 0123 01234' - >>> '01\t012\t0123\t01234'.expandtabs(4) - '01 012 0123 01234' + >>> '01\t012\t0123\t01234'.expandtabs() + '01 012 0123 01234' + >>> '01\t012\t0123\t01234'.expandtabs(4) + '01 012 0123 01234' + >>> print('01\t012\n0123\t01234'.expandtabs(4)) + 01 012 + 0123 01234 str.find(sub[, start[, end]]) @@ -12133,7 +12155,9 @@ accepts integers that meet the value restriction "0 <= x <= 255"). | | replaced by the contents of the | | | | iterable *t* | | +--------------------------------+----------------------------------+-----------------------+ -| "del s[i:j]" | same as "s[i:j] = []" | | +| "del s[i:j]" | removes the elements of "s[i:j]" | | +| | from the list (same as "s[i:j] = | | +| | []") | | +--------------------------------+----------------------------------+-----------------------+ | "s[i:j:k] = t" | the elements of "s[i:j:k]" are | (1) | | | replaced by those of *t* | | @@ -12463,7 +12487,9 @@ accepts integers that meet the value restriction "0 <= x <= 255"). | | replaced by the contents of the | | | | iterable *t* | | +--------------------------------+----------------------------------+-----------------------+ -| "del s[i:j]" | same as "s[i:j] = []" | | +| "del s[i:j]" | removes the elements of "s[i:j]" | | +| | from the list (same as "s[i:j] = | | +| | []") | | +--------------------------------+----------------------------------+-----------------------+ | "s[i:j:k] = t" | the elements of "s[i:j:k]" are | (1) | | | replaced by those of *t* | | |
