1
- # Autogenerated by Sphinx on Wed Jun 11 17:36:53 2025
1
+ # Autogenerated by Sphinx on Wed Aug 6 15:05:15 2025
2
2
# as part of the release process.
3
3
4
4
topics = {
@@ -9055,7 +9055,13 @@ class is used in a class pattern with positional arguments, each
9055
9055
9056
9056
For performance reasons, the value of *errors* is not checked for
9057
9057
validity unless an encoding error actually occurs, Python
9058
- Development Mode is enabled or a debug build is used.
9058
+ Development Mode is enabled or a debug build is used. For example:
9059
+
9060
+ >>> encoded_str_to_bytes = 'Python'.encode()
9061
+ >>> type(encoded_str_to_bytes)
9062
+ <class 'bytes'>
9063
+ >>> encoded_str_to_bytes
9064
+ b'Python'
9059
9065
9060
9066
Changed in version 3.1: Added support for keyword arguments.
9061
9067
@@ -9068,6 +9074,19 @@ class is used in a class pattern with positional arguments, each
9068
9074
otherwise return "False". *suffix* can also be a tuple of suffixes
9069
9075
to look for. With optional *start*, test beginning at that
9070
9076
position. With optional *end*, stop comparing at that position.
9077
+ Using *start* and *end* is equivalent to
9078
+ "str[start:end].endswith(suffix)". For example:
9079
+
9080
+ >>> 'Python'.endswith('on')
9081
+ True
9082
+ >>> 'a tuple of suffixes'.endswith(('at', 'in'))
9083
+ False
9084
+ >>> 'a tuple of suffixes'.endswith(('at', 'es'))
9085
+ True
9086
+ >>> 'Python is amazing'.endswith('is', 0, 9)
9087
+ True
9088
+
9089
+ See also "startswith()" and "removesuffix()".
9071
9090
9072
9091
str.expandtabs(tabsize=8)
9073
9092
@@ -9083,12 +9102,15 @@ class is used in a class pattern with positional arguments, each
9083
9102
("\n") or return ("\r"), it is copied and the current column is
9084
9103
reset to zero. Any other character is copied unchanged and the
9085
9104
current column is incremented by one regardless of how the
9086
- character is represented when printed.
9105
+ character is represented when printed. For example:
9087
9106
9088
- >>> '01\t012\t0123\t01234'.expandtabs()
9089
- '01 012 0123 01234'
9090
- >>> '01\t012\t0123\t01234'.expandtabs(4)
9091
- '01 012 0123 01234'
9107
+ >>> '01\t012\t0123\t01234'.expandtabs()
9108
+ '01 012 0123 01234'
9109
+ >>> '01\t012\t0123\t01234'.expandtabs(4)
9110
+ '01 012 0123 01234'
9111
+ >>> print('01\t012\n0123\t01234'.expandtabs(4))
9112
+ 01 012
9113
+ 0123 01234
9092
9114
9093
9115
str.find(sub[, start[, end]])
9094
9116
@@ -12133,7 +12155,9 @@ class dict(iterable, **kwargs)
12133
12155
| | replaced by the contents of the | |
12134
12156
| | iterable *t* | |
12135
12157
+--------------------------------+----------------------------------+-----------------------+
12136
- | "del s[i:j]" | same as "s[i:j] = []" | |
12158
+ | "del s[i:j]" | removes the elements of "s[i:j]" | |
12159
+ | | from the list (same as "s[i:j] = | |
12160
+ | | []") | |
12137
12161
+--------------------------------+----------------------------------+-----------------------+
12138
12162
| "s[i:j:k] = t" | the elements of "s[i:j:k]" are | (1) |
12139
12163
| | replaced by those of *t* | |
@@ -12463,7 +12487,9 @@ class range(start, stop[, step])
12463
12487
| | replaced by the contents of the | |
12464
12488
| | iterable *t* | |
12465
12489
+--------------------------------+----------------------------------+-----------------------+
12466
- | "del s[i:j]" | same as "s[i:j] = []" | |
12490
+ | "del s[i:j]" | removes the elements of "s[i:j]" | |
12491
+ | | from the list (same as "s[i:j] = | |
12492
+ | | []") | |
12467
12493
+--------------------------------+----------------------------------+-----------------------+
12468
12494
| "s[i:j:k] = t" | the elements of "s[i:j:k]" are | (1) |
12469
12495
| | replaced by those of *t* | |
0 commit comments