chunk_id large_stringlengths 36 36 | doc_type large_stringclasses 2
values | category large_stringclasses 17
values | document large_stringclasses 50
values | version_raw large_stringclasses 590
values | chunk_index int64 0 262 | text large_stringlengths 11 5.69k | file_path large_stringclasses 882
values |
|---|---|---|---|---|---|---|---|
bf7d60ff-9513-5d17-b618-6b442c1f266a | docs | python | python_stdtypes | 314 | 254 | encounter an error during parsing, usually at startup time or import time or
even at installation time - anytime an up to date `.pyc` does not already
exist for the code. A workaround for source that contains such large
constants is to convert them to `0x` hexadecimal form as it has no limit.
Test your application tho... | large_dataset/raw/docs/python/stdtypes/stdtypes_314.md |
8879b716-716d-57dc-85cf-dfab9f949939 | docs | python | python_stdtypes | 314 | 255 | these APIs were added in security patch releases in versions before 3.12.
Example:
```None
>>> import sys
>>> if hasattr(sys, "set_int_max_str_digits"):
... upper_bound = 68000
... lower_bound = 4004
... current_limit = sys.get_int_max_str_digits()
... if current_limit == 0 or current_limit > upper_bo... | large_dataset/raw/docs/python/stdtypes/stdtypes_314.md |
909a40db-db3b-536e-8d37-1c72246abc93 | docs | python | python_stdtypes | 314 | 256 | Cased characters are those with general category property being one of
“Lu” (Letter, uppercase), “Ll” (Letter, lowercase), or “Lt” (Letter, titlecase).
[5]
([1](#id10),[2](#id11))
To format only a tuple you should therefore provide a singleton tuple whose only
element is the tuple to be formatted.
| large_dataset/raw/docs/python/stdtypes/stdtypes_314.md |
c78c763b-d79d-5027-8f1e-1f755f404820 | docs | python | python_stdtypes | 315 | 0 | # Built-in Types¶
Source: https://docs.python.org/3.15/library/stdtypes.html
Version: 3.15
The following sections describe the standard types that are built into the
interpreter.
The principal built-in types are numerics, sequences, mappings, classes,
instances and exceptions.
Some collection classes are mutable. T... | large_dataset/raw/docs/python/stdtypes/stdtypes_315.md |
a8f18b45-02b4-5ef4-8515-99e1057b1122 | docs | python | python_stdtypes | 315 | 1 | ## Truth Value Testing[¶](#truth-value-testing "Link to this heading")
Any object can be tested for truth value, for use in an [`if`](../reference/compound_stmts.html#if) or
[`while`](../reference/compound_stmts.html#while) condition or as operand of the Boolean operations below.
By default, an object is considered t... | large_dataset/raw/docs/python/stdtypes/stdtypes_315.md |
635c381e-7591-54b1-b434-84365eed7b51 | docs | python | python_stdtypes | 315 | 2 | * empty sequences and collections: `''`, `()`, `[]`, `{}`, `set()`,
`range(0)`
Operations and built-in functions that have a Boolean result always return `0`
or `False` for false and `1` or `True` for true, unless otherwise stated.
(Important exception: the Boolean operations `or` and `and` always return
one of thei... | large_dataset/raw/docs/python/stdtypes/stdtypes_315.md |
d5eb6161-4e9f-5f73-abc0-1e99c542ff9f | docs | python | python_stdtypes | 315 | 3 | 3. `not` has a lower priority than non-Boolean operators, so `not a == b` is
interpreted as `not (a == b)`, and `a == not b` is a syntax error.
## Comparisons[¶](#comparisons "Link to this heading")
There are eight comparison operations in Python. They all have the same
priority (which is higher than that of the B... | large_dataset/raw/docs/python/stdtypes/stdtypes_315.md |
1d6c6bc6-cbc7-516e-a809-e8c10d7434de | docs | python | python_stdtypes | 315 | 4 | The `==` operator is always defined but for some object types (for example,
class objects) is equivalent to [`is`](../reference/expressions.html#is). The `<`, `<=`, `>` and `>=`
operators are only defined where they make sense; for example, they raise a
[`TypeError`](exceptions.html#TypeError "TypeError") exception whe... | large_dataset/raw/docs/python/stdtypes/stdtypes_315.md |
e9955cbb-308a-5e1e-845b-27e576042acf | docs | python | python_stdtypes | 315 | 5 | [`__ge__()`](../reference/datamodel.html#object.__ge__ "object.__ge__") (in general, [`__lt__()`](../reference/datamodel.html#object.__lt__ "object.__lt__") and
[`__eq__()`](../reference/datamodel.html#object.__eq__ "object.__eq__") are sufficient, if you want the conventional meanings of the
comparison operators).
Th... | large_dataset/raw/docs/python/stdtypes/stdtypes_315.md |
845135b2-9a1b-5be0-ac1c-3659f08024d9 | docs | python | python_stdtypes | 315 | 6 | ## Numeric Types — [`int`](functions.html#int "int"), [`float`](functions.html#float "float"), [`complex`](functions.html#complex "complex")[¶](#numeric-types-int-float-complex "Link to this heading")
There are three distinct numeric types: *integers*, *floating-point
numbers*, and *complex numbers*. In addition, Bool... | large_dataset/raw/docs/python/stdtypes/stdtypes_315.md |
01d3a626-fb78-53c2-a95d-393a9f5323b4 | docs | python | python_stdtypes | 315 | 7 | rationals, and [`decimal.Decimal`](decimal.html#decimal.Decimal "decimal.Decimal"), for floating-point numbers with
user-definable precision.)
Numbers are created by numeric literals or as the result of built-in functions
and operators. Unadorned integer literals (including hex, octal and binary
numbers) yield integer... | large_dataset/raw/docs/python/stdtypes/stdtypes_315.md |
0a231183-db68-5633-b9d5-a3fac716ccc9 | docs | python | python_stdtypes | 315 | 8 | widened to that of the other, where integer is narrower than floating point.
Arithmetic with complex and real operands is defined by the usual mathematical
formula, for example:
```None
x + complex(u, v) = complex(x + u, v)
x * complex(u, v) = complex(x * u, x * v)
```
A comparison between numbers of different types ... | large_dataset/raw/docs/python/stdtypes/stdtypes_315.md |
3f89ca4d-f40d-5938-be4e-c3cb69d306d0 | docs | python | python_stdtypes | 315 | 9 | | `abs(x)` | absolute value or magnitude of *x* | | [`abs()`](functions.html#abs "abs") |
| `int(x)` | *x* converted to integer | (3)(6) | [`int()`](functions.html#int "int") |
| `float(x)` | *x* converted to floating point | (4)(6) | [`float()`](functions.html#float "float") |
| `complex(re, im)` | a complex number w... | large_dataset/raw/docs/python/stdtypes/stdtypes_315.md |
bd73fa8a-9429-5024-8786-2201567684df | docs | python | python_stdtypes | 315 | 10 | the result has type [`float`](functions.html#float "float"). In general, the result is a whole
integer, though the result’s type is not necessarily [`int`](functions.html#int "int"). The result is
always rounded towards minus infinity: `1//2` is `0`, `(-1)//2` is
`-1`, `1//(-2)` is `-1`, and `(-1)//(-2)` is... | large_dataset/raw/docs/python/stdtypes/stdtypes_315.md |
8671b014-0ee2-5e2c-bbd9-3d9b5296b06e | docs | python | python_stdtypes | 315 | 11 | 6. The numeric literals accepted include the digits `0` to `9` or any
Unicode equivalent (code points with the `Nd` property).
See [the Unicode Standard](https://unicode.org/Public/UNIDATA/extracted/DerivedNumericType.txt)
for a complete list of code points with the `Nd` property.
All [`numbers.Real`](number... | large_dataset/raw/docs/python/stdtypes/stdtypes_315.md |
55dfd2bd-370e-517d-b23a-b535f992f485 | docs | python | python_stdtypes | 315 | 12 | | [`math.ceil(x)`](math.html#math.ceil "math.ceil") | the least [`Integral`](numbers.html#numbers.Integral "numbers.Integral") >= *x* |
For additional numeric operations see the [`math`](math.html#module-math "math: Mathematical functions (sin() etc.).") and [`cmath`](cmath.html#module-cmath "cmath: Mathematical funct... | large_dataset/raw/docs/python/stdtypes/stdtypes_315.md |
be7bc485-3c10-58b3-b5ee-353b44caa294 | docs | python | python_stdtypes | 315 | 13 | | `x | y` | bitwise *or* of *x* and *y* | (4) |
| `x ^ y` | bitwise *exclusive or* of *x* and *y* | (4) |
| `x & y` | bitwise *and* of *x* and *y* | (4) |
| `x << n` | *x* shifted left by *n* bits | (1)(2) |
| `x >> n` | *x* shifted right by *n* bits | (1)(3) |
| `~x` | the bits of *x* inverted | |
Notes:
1. Negativ... | large_dataset/raw/docs/python/stdtypes/stdtypes_315.md |
4118ecc7-dcff-5971-808b-287adb9c77c4 | docs | python | python_stdtypes | 315 | 14 | ### Additional Methods on Integer Types[¶](#additional-methods-on-integer-types "Link to this heading")
The int type implements the [`numbers.Integral`](numbers.html#numbers.Integral "numbers.Integral") [abstract base
class](../glossary.html#term-abstract-base-class). In addition, it provides a few more methods:
int.... | large_dataset/raw/docs/python/stdtypes/stdtypes_315.md |
6b370383-6b15-5fd8-99cc-5c3aaae87f43 | docs | python | python_stdtypes | 315 | 15 | s = bin(self) # binary representation: bin(-37) --> '-0b100101'
s = s.lstrip('-0b') # remove leading zeros and minus sign
return len(s) # len('100101') --> 6
```
Added in version 3.1.
int.bit\_count()[¶](#int.bit_count "Link to this definition")
: Return the number of on... | large_dataset/raw/docs/python/stdtypes/stdtypes_315.md |
47aad20c-1839-5490-bd7b-b35fdf962656 | docs | python | python_stdtypes | 315 | 16 | b'\x00\x00\x00\x00\x00\x00\x00\x00\x04\x00'
>>> (-1024).to_bytes(10, byteorder='big', signed=True)
b'\xff\xff\xff\xff\xff\xff\xff\xff\xfc\x00'
>>> x = 1000
>>> x.to_bytes((x.bit_length() + 7) // 8, byteorder='little')
b'\xe8\x03'
```
The integer is represented using *length* bytes, and ... | large_dataset/raw/docs/python/stdtypes/stdtypes_315.md |
f391c6af-be35-57c2-879e-2371ad0c2627 | docs | python | python_stdtypes | 315 | 17 | given, an [`OverflowError`](exceptions.html#OverflowError "OverflowError") is raised. The default value for *signed*
is `False`.
The default values can be used to conveniently turn an integer into a
single byte object:
```None
>>> (65).to_bytes()
b'A'
```
However, when using the d... | large_dataset/raw/docs/python/stdtypes/stdtypes_315.md |
d4b2ed78-807b-5087-8b5d-329b4e809112 | docs | python | python_stdtypes | 315 | 18 | *classmethod* int.from\_bytes(*bytes*, *byteorder='big'*, *\**, *signed=False*)[¶](#int.from_bytes "Link to this definition")
: Return the integer represented by the given array of bytes.
```None
>>> int.from_bytes(b'\x00\x10', byteorder='big')
16
>>> int.from_bytes(b'\x00\x10', byteorder='little')
... | large_dataset/raw/docs/python/stdtypes/stdtypes_315.md |
40143ebf-3798-52d1-925c-948f1e9b671a | docs | python | python_stdtypes | 315 | 19 | the end of the byte array. To request the native byte order of the host
system, use [`sys.byteorder`](sys.html#sys.byteorder "sys.byteorder") as the byte order value.
The *signed* argument indicates whether two’s complement is used to
represent the integer.
Equivalent to:
```None
def from... | large_dataset/raw/docs/python/stdtypes/stdtypes_315.md |
aa9915db-d026-50d2-88c1-5b074c7d8824 | docs | python | python_stdtypes | 315 | 20 | : Return a pair of integers whose ratio is equal to the original
integer and has a positive denominator. The integer ratio of integers
(whole numbers) is always the integer as the numerator and `1` as the
denominator.
Added in version 3.8.
int.is\_integer()[¶](#int.is_integer "Link to this definitio... | large_dataset/raw/docs/python/stdtypes/stdtypes_315.md |
54b47e6c-bc41-5234-81bb-f30db5f65490 | docs | python | python_stdtypes | 315 | 21 | floating-point number with the same value (within Python’s floating-point
precision) is returned. If the argument is outside the range of a Python
float, an [`OverflowError`](exceptions.html#OverflowError "OverflowError") will be raised.
For a general Python object `x`, `float.from_number(x)` delegates... | large_dataset/raw/docs/python/stdtypes/stdtypes_315.md |
0c8fb027-5cb7-5c97-aa59-fdcfb06cccf6 | docs | python | python_stdtypes | 315 | 22 | float.is\_integer()[¶](#float.is_integer "Link to this definition")
: Return `True` if the float instance is finite with integral
value, and `False` otherwise:
```None
>>> (-2.0).is_integer()
True
>>> (3.2).is_integer()
False
```
Two methods support conversion to
and from hexadecimal str... | large_dataset/raw/docs/python/stdtypes/stdtypes_315.md |
cc388889-3023-51dc-b0ec-25a9ce315050 | docs | python | python_stdtypes | 315 | 23 | : Class method to return the float represented by a hexadecimal
string *s*. The string *s* may have leading and trailing
whitespace.
Note that [`float.hex()`](#float.hex "float.hex") is an instance method, while
[`float.fromhex()`](#float.fromhex "float.fromhex") is a class method.
A hexadecimal string take... | large_dataset/raw/docs/python/stdtypes/stdtypes_315.md |
43488d42-a798-592a-b0aa-2f0435b20553 | docs | python | python_stdtypes | 315 | 24 | character or Java’s `Double.toHexString` are accepted by
[`float.fromhex()`](#float.fromhex "float.fromhex").
Note that the exponent is written in decimal rather than hexadecimal,
and that it gives the power of 2 by which to multiply the coefficient.
For example, the hexadecimal string `0x3.a7p10` represents the
float... | large_dataset/raw/docs/python/stdtypes/stdtypes_315.md |
dc4ae3d9-dc8c-5848-8702-0cef15204c4f | docs | python | python_stdtypes | 315 | 25 | : Class method to convert a number to a complex number.
For a general Python object `x`, `complex.from_number(x)` delegates to
`x.__complex__()`. If [`__complex__()`](../reference/datamodel.html#object.__complex__ "object.__complex__") is not defined then it falls back
to [`__float__()`](../reference/dat... | large_dataset/raw/docs/python/stdtypes/stdtypes_315.md |
bbe15ee0-0032-5e0e-80eb-082a0bd01064 | docs | python | python_stdtypes | 315 | 26 | [`float`](functions.html#float "float"), [`decimal.Decimal`](decimal.html#decimal.Decimal "decimal.Decimal") and [`fractions.Fraction`](fractions.html#fractions.Fraction "fractions.Fraction"))
Python’s hash for numeric types is based on a single mathematical function
that’s defined for any rational number, and hence ap... | large_dataset/raw/docs/python/stdtypes/stdtypes_315.md |
58bb1994-dfc9-5f69-91d1-625de80f2b77 | docs | python | python_stdtypes | 315 | 27 | longs and `P = 2**61 - 1` on machines with 64-bit C longs.
Here are the rules in detail:
* If `x = m / n` is a nonnegative rational number and `n` is not divisible
by `P`, define `hash(x)` as `m * invmod(n, P) % P`, where `invmod(n,
P)` gives the inverse of `n` modulo `P`.
* If `x = m / n` is a nonnegative ration... | large_dataset/raw/docs/python/stdtypes/stdtypes_315.md |
81bded97-dee4-5b79-99ac-2f5c3de8baf4 | docs | python | python_stdtypes | 315 | 28 | sys.hash_info.imag * hash(z.imag)`, reduced modulo
`2**sys.hash_info.width` so that it lies in
`range(-2**(sys.hash_info.width - 1), 2**(sys.hash_info.width -
1))`. Again, if the result is `-1`, it’s replaced with `-2`.
To clarify the above rules, here’s some example Python code,
equivalent to the built-in has... | large_dataset/raw/docs/python/stdtypes/stdtypes_315.md |
c5266be0-0de1-5fbf-9f22-fb504e3a0588 | docs | python | python_stdtypes | 315 | 29 | # pow(n, P-2, P) gives the inverse of n modulo P.
hash_value = (abs(m) % P) * pow(n, P - 2, P) % P
if m < 0:
hash_value = -hash_value
if hash_value == -1:
hash_value = -2
return hash_value
def hash_float(x):
"""Compute the hash of a float x."""
if math.isnan(x):
... | large_dataset/raw/docs/python/stdtypes/stdtypes_315.md |
d6b70078-829b-5ebd-ac9e-1471b84efa42 | docs | python | python_stdtypes | 315 | 30 | ## Boolean Type - [`bool`](functions.html#bool "bool")[¶](#boolean-type-bool "Link to this heading")
Booleans represent truth values. The [`bool`](functions.html#bool "bool") type has exactly two
constant instances: `True` and `False`.
The built-in function [`bool()`](functions.html#bool "bool") converts any value to... | large_dataset/raw/docs/python/stdtypes/stdtypes_315.md |
2ce9630e-f55f-574f-80f6-5f2bd8da4628 | docs | python | python_stdtypes | 315 | 31 | [`bool`](functions.html#bool "bool") is a subclass of [`int`](functions.html#int "int") (see [Numeric Types — int, float, complex](#typesnumeric)). In
many numeric contexts, `False` and `True` behave like the integers 0 and 1, respectively.
However, relying on this is discouraged; explicitly convert using [`int()`](fun... | large_dataset/raw/docs/python/stdtypes/stdtypes_315.md |
9f1c62c3-369d-5347-9bf1-e956641cdcd8 | docs | python | python_stdtypes | 315 | 32 | iterator protocol described below. If a container supports different types
of iteration, additional methods can be provided to specifically request
iterators for those iteration types. (An example of an object supporting
multiple forms of iteration would be a tree structure which supports both
bread... | large_dataset/raw/docs/python/stdtypes/stdtypes_315.md |
a4e0d6f5-f1fa-55b6-888a-b14ec4fe4212 | docs | python | python_stdtypes | 315 | 33 | [`in`](../reference/expressions.html#in) statements. This method corresponds to the
[`tp_iter`](../c-api/typeobj.html#c.PyTypeObject.tp_iter "PyTypeObject.tp_iter") slot of the type structure for Python
objects in the Python/C API.
iterator.\_\_next\_\_()[¶](#iterator.__next__ "Link to this definition")
: ... | large_dataset/raw/docs/python/stdtypes/stdtypes_315.md |
d5008a31-f162-50e5-8828-b43736036281 | docs | python | python_stdtypes | 315 | 34 | Once an iterator’s [`__next__()`](#iterator.__next__ "iterator.__next__") method raises
[`StopIteration`](exceptions.html#StopIteration "StopIteration"), it must continue to do so on subsequent calls.
Implementations that do not obey this property are deemed broken.
### Generator Types[¶](#generator-types "Link to thi... | large_dataset/raw/docs/python/stdtypes/stdtypes_315.md |
168e871b-db89-5dbf-a749-232fe7d09b8f | docs | python | python_stdtypes | 315 | 35 | ## Sequence Types — [`list`](#list "list"), [`tuple`](#tuple "tuple"), [`range`](#range "range")[¶](#sequence-types-list-tuple-range "Link to this heading")
There are three basic sequence types: lists, tuples, and range objects.
Additional sequence types tailored for processing of
[binary data](#binaryseq) and [text s... | large_dataset/raw/docs/python/stdtypes/stdtypes_315.md |
83b400aa-63d7-5b7c-8c1a-eb5b1c627200 | docs | python | python_stdtypes | 315 | 36 | restrictions imposed by *s*.
The `in` and `not in` operations have the same priorities as the
comparison operations. The `+` (concatenation) and `*` (repetition)
operations have the same priority as the corresponding numeric operations. [[3]](#id14)
| Operation | Result | Notes |
| --- | --- | --- |
| `x in s` | `Tru... | large_dataset/raw/docs/python/stdtypes/stdtypes_315.md |
3e0e113b-f7cd-57e9-b9f9-b91eb52fb57f | docs | python | python_stdtypes | 315 | 37 | and lists are compared lexicographically by comparing corresponding elements.
This means that to compare equal, every element must compare equal and the
two sequences must be of the same type and have the same length. (For full
details see [Comparisons](../reference/expressions.html#comparisons) in the language referen... | large_dataset/raw/docs/python/stdtypes/stdtypes_315.md |
2ce895df-0d5e-5688-9376-de674c6b392c | docs | python | python_stdtypes | 315 | 38 | ```None
>>> "gg" in "eggs"
True
```
2. Values of *n* less than `0` are treated as `0` (which yields an empty
sequence of the same type as *s*). Note that items in the sequence *s*
are not copied; they are referenced multiple times. This often haunts
new Python programmers; consider:
```None
... | large_dataset/raw/docs/python/stdtypes/stdtypes_315.md |
5dc1ed6f-8fb9-52c0-bdf6-c1c41bc5a22a | docs | python | python_stdtypes | 315 | 39 | [How do I create a multidimensional list?](../faq/programming.html#faq-multidimensional-list).
3. If *i* or *j* is negative, the index is relative to the end of sequence *s*:
`len(s) + i` or `len(s) + j` is substituted. But note that `-0` is
still `0`.
4. The slice of *s* from *i* to *j* is defined as the sequ... | large_dataset/raw/docs/python/stdtypes/stdtypes_315.md |
4110e5db-8361-5805-827b-bcea5bb93af7 | docs | python | python_stdtypes | 315 | 40 | When *k* is negative, *i* and *j* are reduced to `len(s) - 1` if
they are greater. If *i* or *j* are omitted or `None`, they become
“end” values (which end depends on the sign of *k*). Note, *k* cannot be zero.
If *k* is `None`, it is treated like `1`.
6. Concatenating immutable sequences always results in ... | large_dataset/raw/docs/python/stdtypes/stdtypes_315.md |
82ca0011-6603-598b-983e-46ffa240f4a9 | docs | python | python_stdtypes | 315 | 41 | concatenation with a [`bytearray`](#bytearray "bytearray") object. [`bytearray`](#bytearray "bytearray")
objects are mutable and have an efficient overallocation mechanism
* if concatenating [`tuple`](#tuple "tuple") objects, extend a [`list`](#list "list") instead
* for other types, investigate the rel... | large_dataset/raw/docs/python/stdtypes/stdtypes_315.md |
358f895c-34d2-50d0-bc62-82ab6d68f5cc | docs | python | python_stdtypes | 315 | 42 | Raises [`ValueError`](exceptions.html#ValueError "ValueError") if *value* is not found in *sequence*.
The *start* or *stop* arguments allow for efficient searching
of subsections of the sequence, beginning at *start* and ending at *stop*.
This is roughly equivalent to `start + sequence[start:stop].inde... | large_dataset/raw/docs/python/stdtypes/stdtypes_315.md |
ef55c533-3b0b-59cc-a54b-0ed5e7ed1e0b | docs | python | python_stdtypes | 315 | 43 | Attempting to hash an immutable sequence that contains unhashable values will
result in [`TypeError`](exceptions.html#TypeError "TypeError").
### Mutable Sequence Types[¶](#mutable-sequence-types "Link to this heading")
The operations in the following table are defined on mutable sequence types.
The [`collections.abc... | large_dataset/raw/docs/python/stdtypes/stdtypes_315.md |
2cb95597-475d-5e9e-a9b9-659691285f91 | docs | python | python_stdtypes | 315 | 44 | | `s[i:j] = t` | slice of *s* from *i* to *j* is replaced by the contents of the iterable *t* | |
| `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 replaced by those of *t* | (1) |
| `del s[i:j:k]` | removes the elements of `s... | large_dataset/raw/docs/python/stdtypes/stdtypes_315.md |
f7ceaee4-e0e0-5469-babd-931a159e98bb | docs | python | python_stdtypes | 315 | 45 | Mutable sequence types also support the following methods:
sequence.append(*value*, */*)[¶](#sequence.append "Link to this definition")
: Append *value* to the end of the sequence
This is equivalent to writing `seq[len(seq):len(seq)] = [value]`.
sequence.clear()[¶](#sequence.clear "Link to this definition")
: ... | large_dataset/raw/docs/python/stdtypes/stdtypes_315.md |
3ff196f7-5bdb-514c-9032-248d6824f8b8 | docs | python | python_stdtypes | 315 | 46 | For the most part, this is the same as writing
`seq[len(seq):len(seq)] = iterable`.
sequence.insert(*index*, *value*, */*)[¶](#sequence.insert "Link to this definition")
: Insert *value* into *sequence* at the given *index*.
This is equivalent to writing `sequence[index:index] = [value]`.
sequence.pop(*... | large_dataset/raw/docs/python/stdtypes/stdtypes_315.md |
00fabf66-9502-52c0-aaeb-4438e3d2a49c | docs | python | python_stdtypes | 315 | 47 | To remind users that it operates by side-effect, it returns `None`.
### Lists[¶](#lists "Link to this heading")
Lists are mutable sequences, typically used to store collections of
homogeneous items (where the precise degree of similarity will vary by
application).
*class* list(*iterable=()*, */*)[¶](#list "Link ... | large_dataset/raw/docs/python/stdtypes/stdtypes_315.md |
b9fc3e76-ae88-5c6d-a4ce-550549d8c3d6 | docs | python | python_stdtypes | 315 | 48 | `list( (1, 2, 3) )` returns `[1, 2, 3]`.
If no argument is given, the constructor creates a new empty list, `[]`.
Many other operations also produce lists, including the [`sorted()`](functions.html#sorted "sorted")
built-in.
Lists implement all of the [common](#typesseq-common) and
[mutable](#... | large_dataset/raw/docs/python/stdtypes/stdtypes_315.md |
08491a71-5d27-52fa-b0ea-90072c2e5ff8 | docs | python | python_stdtypes | 315 | 49 | *key* specifies a function of one argument that is used to extract a
comparison key from each list element (for example, `key=str.lower`).
The key corresponding to each item in the list is calculated once and
then used for the entire sorting process. The default value of `None`
m... | large_dataset/raw/docs/python/stdtypes/stdtypes_315.md |
5c8bbba3-445c-529a-aaef-8c8c66f59785 | docs | python | python_stdtypes | 315 | 50 | explicitly request a new sorted list instance).
The [`sort()`](#list.sort "list.sort") method is guaranteed to be stable. A sort is stable if it
guarantees not to change the relative order of elements that compare equal
— this is helpful for sorting in multiple passes (for example, sort... | large_dataset/raw/docs/python/stdtypes/stdtypes_315.md |
951cafdd-b7e6-5a7b-a2b6-999e5d389b7d | docs | python | python_stdtypes | 315 | 51 | lst[i] # list.__getitem__
```
The following methods traverse the list and use [atomic](../glossary.html#term-atomic-operation)
reads of each item to perform their function. That means that they may
return results affected by concurrent modifications:
```None
item in lst
lst.index(item)
lst.count(item)
```
All of t... | large_dataset/raw/docs/python/stdtypes/stdtypes_315.md |
98875baa-62df-51ab-bba2-817fd48a1f74 | docs | python | python_stdtypes | 315 | 52 | Methods that only operate on a single elements with no shifting required are
[atomic](../glossary.html#term-atomic-operation):
```None
lst.append(x) # append to the end of the list, no shifting required
lst.pop() # pop element from the end of the list, no shifting required
```
The [`clear()`](#list.clear "list.... | large_dataset/raw/docs/python/stdtypes/stdtypes_315.md |
b756eee5-f249-5cd6-a60e-728e20113751 | docs | python | python_stdtypes | 315 | 53 | The [`remove()`](#list.remove "list.remove") method may allow concurrent modifications since
element comparison may execute arbitrary Python code (via
[`__eq__()`](../reference/datamodel.html#object.__eq__ "object.__eq__")).
[`extend()`](#list.extend "list.extend") is safe to call from multiple threads. However, its
g... | large_dataset/raw/docs/python/stdtypes/stdtypes_315.md |
b602518c-9443-5e8f-bea3-36443d0d221a | docs | python | python_stdtypes | 315 | 54 | also a [`list`](#list "list") (but not its subclasses).
Operations that involve multiple accesses, as well as iteration, are never
atomic. For example:
```None
# NOT atomic: read-modify-write
lst[i] = lst[i] + 1
# NOT atomic: check-then-act
if lst:
item = lst.pop()
# NOT thread-safe: iteration while modifying
f... | large_dataset/raw/docs/python/stdtypes/stdtypes_315.md |
0460982b-ab29-5441-955d-53fc6f3db75b | docs | python | python_stdtypes | 315 | 55 | [`dict`](#dict "dict") instance).
*class* tuple(*iterable=()*, */*)[¶](#tuple "Link to this definition")
: Tuples may be constructed in a number of ways:
* Using a pair of parentheses to denote the empty tuple: `()`
* Using a trailing comma for a singleton tuple: `a,` or `(a,)`
* Separating items with c... | large_dataset/raw/docs/python/stdtypes/stdtypes_315.md |
9d04a5e5-2bb2-5bd6-a4d4-39f0fccf159f | docs | python | python_stdtypes | 315 | 56 | The parentheses are optional, except in the empty tuple case, or
when they are needed to avoid syntactic ambiguity. For example,
`f(a, b, c)` is a function call with three arguments, while
`f((a, b, c))` is a function call with a 3-tuple as the sole argument.
Tuples implement all of the [common](#t... | large_dataset/raw/docs/python/stdtypes/stdtypes_315.md |
475a2363-8ca8-5542-b564-a1c81808dbb3 | docs | python | python_stdtypes | 315 | 57 | : The arguments to the range constructor must be integers (either built-in
[`int`](functions.html#int "int") or any object that implements the [`__index__()`](../reference/datamodel.html#object.__index__ "object.__index__") special
method). If the *step* argument is omitted, it defaults to `1`.
If the *st... | large_dataset/raw/docs/python/stdtypes/stdtypes_315.md |
5008f3d3-1379-5ec0-80ac-88645d40af64 | docs | python | python_stdtypes | 315 | 58 | Ranges containing absolute values larger than [`sys.maxsize`](sys.html#sys.maxsize "sys.maxsize") are
permitted but some features (such as [`len()`](functions.html#len "len")) may raise
[`OverflowError`](exceptions.html#OverflowError "OverflowError").
Range examples:
```None
>>> list(range(10)... | large_dataset/raw/docs/python/stdtypes/stdtypes_315.md |
7d8a7ded-7a50-5e5d-b939-fe3d754f65b6 | docs | python | python_stdtypes | 315 | 59 | : The value of the *start* parameter (or `0` if the parameter was
not supplied)
stop[¶](#range.stop "Link to this definition")
: The value of the *stop* parameter
step[¶](#range.step "Link to this definition")
: The value of the *step* parameter (or `1` if the parameter was
n... | large_dataset/raw/docs/python/stdtypes/stdtypes_315.md |
742201b8-fae5-546e-9620-a983d7750e33 | docs | python | python_stdtypes | 315 | 60 | >>> r = range(0, 20, 2)
>>> r
range(0, 20, 2)
>>> 11 in r
False
>>> 10 in r
True
>>> r.index(10)
5
>>> r[5]
10
>>> r[:5]
range(0, 10, 2)
>>> r[-1]
18
```
Testing range objects for equality with `==` and `!=` compares
them as sequences. That is, two range objects are considered equal if
they represent the same sequence... | large_dataset/raw/docs/python/stdtypes/stdtypes_315.md |
714d4e38-1ff9-5b9a-818c-528f99202ebc | docs | python | python_stdtypes | 315 | 61 | Added the [`start`](#range.start "range.start"), [`stop`](#range.stop "range.stop") and [`step`](#range.step "range.step")
attributes.
See also
* The [linspace recipe](https://code.activestate.com/recipes/579000-equally-spaced-numbers-linspace/)
shows how to implement a lazy version of range suitable for floating-p... | large_dataset/raw/docs/python/stdtypes/stdtypes_315.md |
c85b766c-d51a-5805-a8c2-de35278ec615 | docs | python | python_stdtypes | 315 | 62 | | [printf-style String Formatting](#old-string-formatting) | | | | [printf-style Bytes Formatting](#bytes-formatting) | | | |
| Searching and Replacing | [`str.find()`](#str.find "str.find") | [`str.rfind()`](#str.rfind "str.rfind") | | | [`bytes.find()`](#bytes.find "bytes.find") | [`bytes.rfind()`](#bytes.rfind "byte... | large_dataset/raw/docs/python/stdtypes/stdtypes_315.md |
fcac6162-646d-50ca-9313-39e6aa6ecc24 | docs | python | python_stdtypes | 315 | 63 | | Splitting and Joining | [`str.split()`](#str.split "str.split") | | [`str.rsplit()`](#str.rsplit "str.rsplit") | | [`bytes.split()`](#bytes.split "bytes.split") | | [`bytes.rsplit()`](#bytes.rsplit "bytes.rsplit") | |
| [`str.splitlines()`](#str.splitlines "str.splitlines") | | | | [`bytes.splitlines()`](#bytes.split... | large_dataset/raw/docs/python/stdtypes/stdtypes_315.md |
fd541a54-196c-50b1-aa6c-6b5b1128c843 | docs | python | python_stdtypes | 315 | 64 | | [`str.isdigit()`](#str.isdigit "str.isdigit") | | | | [`bytes.isdigit()`](#bytes.isdigit "bytes.isdigit") | | | |
| [`str.isnumeric()`](#str.isnumeric "str.isnumeric") | | | | | | | |
| [`str.isalnum()`](#str.isalnum "str.isalnum") | | | | [`bytes.isalnum()`](#bytes.isalnum "bytes.isalnum") | | | |
| [`str.isidentif... | large_dataset/raw/docs/python/stdtypes/stdtypes_315.md |
945ca403-870e-5a74-8ed0-5bcace5c07e1 | docs | python | python_stdtypes | 315 | 65 | | Case Manipulation | [`str.lower()`](#str.lower "str.lower") | | | | [`bytes.lower()`](#bytes.lower "bytes.lower") | | | |
| [`str.upper()`](#str.upper "str.upper") | | | | [`bytes.upper()`](#bytes.upper "bytes.upper") | | | |
| [`str.casefold()`](#str.casefold "str.casefold") | | | | | | | |
| [`str.capitalize()`](#... | large_dataset/raw/docs/python/stdtypes/stdtypes_315.md |
9c474322-163a-50ad-aa30-9b80552b79f3 | docs | python | python_stdtypes | 315 | 66 | | [`str.expandtabs()`](#str.expandtabs "str.expandtabs") | | | | [`bytes.expandtabs()`](#bytes.expandtabs "bytes.expandtabs") | | | |
| [`str.strip()`](#str.strip "str.strip") | | | | [`bytes.strip()`](#bytes.strip "bytes.strip") | | | |
| [`str.lstrip()`](#str.lstrip "str.lstrip") | | | [`str.rstrip()`](#str.rstrip "s... | large_dataset/raw/docs/python/stdtypes/stdtypes_315.md |
b79f8546-a232-5cca-83a0-703487ce43a8 | docs | python | python_stdtypes | 315 | 67 | ## Text Sequence Type — [`str`](#str "str")[¶](#text-sequence-type-str "Link to this heading")
Textual data in Python is handled with [`str`](#str "str") objects, or *strings*.
Strings are immutable
[sequences](#typesseq) of Unicode code points. String literals are
written in a variety of ways:
* Single quotes: `'all... | large_dataset/raw/docs/python/stdtypes/stdtypes_315.md |
11b7da0c-3a13-5db6-8940-973f2af7b442 | docs | python | python_stdtypes | 315 | 68 | including supported [escape sequences](../reference/lexical_analysis.html#escape-sequences), and the `r` (“raw”) prefix that
disables most escape sequence processing.
Strings may also be created from other objects using the [`str`](#str "str")
constructor.
Since there is no separate “character” type, indexing a strin... | large_dataset/raw/docs/python/stdtypes/stdtypes_315.md |
fb4abd5f-9fb0-52e2-b73c-abf4f81324fb | docs | python | python_stdtypes | 315 | 69 | *class* str(*object*, *\**, *errors*)
: Return a [string](#textseq) version of *object*. If *object* is not
provided, returns the empty string. Otherwise, the behavior of `str()`
depends on whether *encoding* or *errors* is given, as follows.
If neither *encoding* nor *errors* is given, `str(object)` ret... | large_dataset/raw/docs/python/stdtypes/stdtypes_315.md |
08ebf0b7-e619-53da-b2b2-272bb0f82336 | docs | python | python_stdtypes | 315 | 70 | this case, if *object* is a [`bytes`](#bytes "bytes") (or [`bytearray`](#bytearray "bytearray")) object,
then `str(bytes, encoding, errors)` is equivalent to
[`bytes.decode(encoding, errors)`](#bytes.decode "bytes.decode"). Otherwise, the bytes
object underlying the buffer object is obtained before call... | large_dataset/raw/docs/python/stdtypes/stdtypes_315.md |
8eccc028-4190-5f11-9f4b-4fc385f5e1de | docs | python | python_stdtypes | 315 | 71 | [Text Sequence Type — str](#textseq) and the [String Methods](#string-methods) section below. To output
formatted strings, see the [f-strings](../reference/lexical_analysis.html#f-strings) and [Format String Syntax](string.html#formatstrings)
sections. In addition, see the [Text Processing Services](text.ht... | large_dataset/raw/docs/python/stdtypes/stdtypes_315.md |
baf27cf7-bda7-5254-b80f-c402e652b30d | docs | python | python_stdtypes | 315 | 72 | handle ([printf-style String Formatting](#old-string-formatting)).
The [Text Processing Services](text.html#textservices) section of the standard library covers a number of
other modules that provide various text related utilities (including regular
expression support in the [`re`](re.html#module-re "re: Regular expre... | large_dataset/raw/docs/python/stdtypes/stdtypes_315.md |
9c5d7e86-22d9-50a7-aa31-e940848be53c | docs | python | python_stdtypes | 315 | 73 | intended to remove all case distinctions in a string. For example, the German
lowercase letter `'ß'` is equivalent to `"ss"`. Since it is already
lowercase, [`lower()`](#str.lower "str.lower") would do nothing to `'ß'`; [`casefold()`](#str.casefold "str.casefold")
converts it to `"ss"`.
For example:... | large_dataset/raw/docs/python/stdtypes/stdtypes_315.md |
527a70b7-6b41-5ca1-b2ac-d43faa74f059 | docs | python | python_stdtypes | 315 | 74 | >>> 'Python'.center(10, '-')
'--Python--'
>>> 'Python'.center(4)
'Python'
```
str.count(*sub*[, *start*[, *end*]])[¶](#str.count "Link to this definition")
: Return the number of non-overlapping occurrences of substring *sub* in the
range [*start*, *end*]. Optional arguments *start* and *end*... | large_dataset/raw/docs/python/stdtypes/stdtypes_315.md |
c2536d1a-5694-5eb2-a929-c9f69b557eff | docs | python | python_stdtypes | 315 | 75 | see [Standard Encodings](codecs.html#standard-encodings) for possible values.
*errors* controls how encoding errors are handled.
If `'strict'` (the default), a [`UnicodeError`](exceptions.html#UnicodeError "UnicodeError") exception is raised.
Other possible values are `'ignore'`,
`'replace'`, `'xml... | large_dataset/raw/docs/python/stdtypes/stdtypes_315.md |
40a894e1-1418-57d1-bf2a-b4cf0605ef2a | docs | python | python_stdtypes | 315 | 76 | Changed in version 3.1: Added support for keyword arguments.
Changed in version 3.9: The value of the *errors* argument is now checked in [Python Development Mode](devmode.html#devmode) and
in [debug mode](../using/configure.html#debug-build).
str.endswith(*suffix*[, *start*[, *end*]])[¶](#str.endswith "L... | large_dataset/raw/docs/python/stdtypes/stdtypes_315.md |
45218301-8a60-5b86-8f4e-5a6f63f04211 | docs | python | python_stdtypes | 315 | 77 | See also [`startswith()`](#str.startswith "str.startswith") and [`removesuffix()`](#str.removesuffix "str.removesuffix").
str.expandtabs(*tabsize=8*)[¶](#str.expandtabs "Link to this definition")
: Return a copy of the string where all tab characters are replaced by one or
more spaces, depending on the curre... | large_dataset/raw/docs/python/stdtypes/stdtypes_315.md |
0601cd1f-009d-5d09-9963-9f2292a7c3c9 | docs | python | python_stdtypes | 315 | 78 | incremented by one regardless of how the character is represented when
printed. For example:
```None
>>> '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))
... | large_dataset/raw/docs/python/stdtypes/stdtypes_315.md |
d1e086b5-6bfc-5e65-989b-73d51a41c08a | docs | python | python_stdtypes | 315 | 79 | position of *sub*. To check if *sub* is a substring or not, use the
[`in`](../reference/expressions.html#in) operator:
```None
>>> 'Py' in 'Python'
True
```
str.format(*\*args*, *\*\*kwargs*)[¶](#str.format "Link to this definition")
: Perform a string formatting operation. The string on whi... | large_dataset/raw/docs/python/stdtypes/stdtypes_315.md |
1e8925db-f882-58d8-a380-18391b72d93e | docs | python | python_stdtypes | 315 | 80 | See [Format String Syntax](string.html#formatstrings) for a description of the various formatting options
that can be specified in format strings.
Note
When formatting a number ([`int`](functions.html#int "int"), [`float`](functions.html#float "float"), [`complex`](functions.html#complex "complex"),
... | large_dataset/raw/docs/python/stdtypes/stdtypes_315.md |
7c6d0aba-f5de-5e81-97a6-a9e9a2eced41 | docs | python | python_stdtypes | 315 | 81 | str.format\_map(*mapping*, */*)[¶](#str.format_map "Link to this definition")
: Similar to `str.format(**mapping)`, except that `mapping` is
used directly and not copied to a [`dict`](#dict "dict"). This is useful
if for example `mapping` is a dict subclass:
```None
>>> class Default(dict):
... ... | large_dataset/raw/docs/python/stdtypes/stdtypes_315.md |
ad857c1c-f82b-50a4-8eee-6cf1155fad3d | docs | python | python_stdtypes | 315 | 82 | ~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^
ValueError: substring not found
```
See also [`rindex()`](#str.rindex "str.rindex").
str.isalnum()[¶](#str.isalnum "Link to this definition")
: Return `True` if all characters in the string are alphanumeric and there is at
least one character, `False` otherwi... | large_dataset/raw/docs/python/stdtypes/stdtypes_315.md |
ac26a757-b62d-56a3-904d-b92324e5c5fc | docs | python | python_stdtypes | 315 | 83 | Ideographic’ of the Unicode Standard](https://www.unicode.org/versions/Unicode17.0.0/core-spec/chapter-4/#G91002).
For example:
```None
>>> 'Letters and spaces'.isalpha()
False
>>> 'LettersOnly'.isalpha()
True
>>> 'µ'.isalpha() # non-ASCII characters can be considered alphabetical too
... | large_dataset/raw/docs/python/stdtypes/stdtypes_315.md |
06dd7a88-e093-5781-a5c3-7c1f000b1990 | docs | python | python_stdtypes | 315 | 84 | otherwise. Decimal characters are those that can be used to form
numbers in base 10, such as U+0660, ARABIC-INDIC DIGIT
ZERO. Formally a decimal character is a character in the Unicode
General Category “Nd”. For example:
```None
>>> '0123456789'.isdecimal()
True
>>> '٠١٢٣٤٥٦٧٨٩'.isdecim... | large_dataset/raw/docs/python/stdtypes/stdtypes_315.md |
b72626ef-3c91-57d8-9233-f5eada59e6c4 | docs | python | python_stdtypes | 315 | 85 | : Return `True` if the string is a valid identifier according to the language
definition, section [Names (identifiers and keywords)](../reference/lexical_analysis.html#identifiers).
[`keyword.iskeyword()`](keyword.html#keyword.iskeyword "keyword.iskeyword") can be used to test whether string `s` is a reserve... | large_dataset/raw/docs/python/stdtypes/stdtypes_315.md |
e960117c-9e38-56d4-8558-f3efb3b0e3e3 | docs | python | python_stdtypes | 315 | 86 | characters, and there is at least one character, `False`
otherwise. Numeric characters include digit characters, and all characters
that have the Unicode numeric value property, e.g. U+2155,
VULGAR FRACTION ONE FIFTH. Formally, numeric characters are those with the property
value Numeric\_Type=Digit... | large_dataset/raw/docs/python/stdtypes/stdtypes_315.md |
d3b84319-18b9-5025-9d2c-1da5c559e2e9 | docs | python | python_stdtypes | 315 | 87 | contains at least one non-printable character.
Here “printable” means the character is suitable for [`repr()`](functions.html#repr "repr") to use in
its output; “non-printable” means that [`repr()`](functions.html#repr "repr") on built-in types will
hex-escape the character. It has no bearing on the ha... | large_dataset/raw/docs/python/stdtypes/stdtypes_315.md |
47cc31b1-09f3-5cf5-a23f-019bf15eede5 | docs | python | python_stdtypes | 315 | 88 | (False, False)
```
str.isspace()[¶](#str.isspace "Link to this definition")
: Return `True` if there are only whitespace characters in the string and there is
at least one character, `False` otherwise.
A character is *whitespace* if in the Unicode character database
(see [`unicodedata`](unicoded... | large_dataset/raw/docs/python/stdtypes/stdtypes_315.md |
1ec20f59-6d00-5fa5-9387-c841254fd97c | docs | python | python_stdtypes | 315 | 89 | See also [`title()`](#str.title "str.title").
str.isupper()[¶](#str.isupper "Link to this definition")
: Return `True` if all cased characters [[4]](#id15) in the string are uppercase and
there is at least one cased character, `False` otherwise.
```None
>>> 'BANANA'.isupper()
True
>>> 'banan... | large_dataset/raw/docs/python/stdtypes/stdtypes_315.md |
0e2b88df-d2fe-5b60-a8a7-4c024b0c5ec9 | docs | python | python_stdtypes | 315 | 90 | str.ljust(*width*, *fillchar=' '*, */*)[¶](#str.ljust "Link to this definition")
: Return the string left justified in a string of length *width*. Padding is
done using the specified *fillchar* (default is an ASCII space). The
original string is returned if *width* is less than or equal to `len(s)`.
For ... | large_dataset/raw/docs/python/stdtypes/stdtypes_315.md |
e41938fb-c4bb-5259-801a-5d33eb4890db | docs | python | python_stdtypes | 315 | 91 | str.lstrip(*chars=None*, */*)[¶](#str.lstrip "Link to this definition")
: Return a copy of the string with leading characters removed. The *chars*
argument is a string specifying the set of characters to be removed. If omitted
or `None`, the *chars* argument defaults to removing whitespace. The *chars*
ar... | large_dataset/raw/docs/python/stdtypes/stdtypes_315.md |
8caf884d-4623-5961-9912-f2597fe3d736 | docs | python | python_stdtypes | 315 | 92 | : This static method returns a translation table usable for [`str.translate()`](#str.translate "str.translate").
If there is only one argument, it must be a dictionary mapping Unicode
ordinals (integers) or characters (strings of length 1) to Unicode ordinals,
strings (of arbitrary lengths) or `None`. Ch... | large_dataset/raw/docs/python/stdtypes/stdtypes_315.md |
ba132621-bfad-54e8-b708-b5870cb2dfcf | docs | python | python_stdtypes | 315 | 93 | the string itself, followed by two empty strings.
str.removeprefix(*prefix*, */*)[¶](#str.removeprefix "Link to this definition")
: If the string starts with the *prefix* string, return
`string[len(prefix):]`. Otherwise, return a copy of the original
string:
```None
>>> 'TestHook'.removeprefix('... | large_dataset/raw/docs/python/stdtypes/stdtypes_315.md |
c35cd601-c17c-5bec-8dcd-a001c1e60585 | docs | python | python_stdtypes | 315 | 94 | See also [`removeprefix()`](#str.removeprefix "str.removeprefix") and [`endswith()`](#str.endswith "str.endswith").
str.replace(*old*, *new*, */*, *count=-1*)[¶](#str.replace "Link to this definition")
: Return a copy of the string with all occurrences of substring *old* replaced by
*new*. If *count* is give... | large_dataset/raw/docs/python/stdtypes/stdtypes_315.md |
a32ff76e-44a9-5dba-944c-f3515aa5694a | docs | python | python_stdtypes | 315 | 95 | and *end* are interpreted as in slice notation. Return `-1` on failure.
For example:
```None
>>> 'spam, spam, spam'.rfind('sp')
12
>>> 'spam, spam, spam'.rfind('sp', 0, 10)
6
```
See also [`find()`](#str.find "str.find") and [`rindex()`](#str.rindex "str.rindex").
str.rindex(*sub*... | large_dataset/raw/docs/python/stdtypes/stdtypes_315.md |
6a3cdedd-180f-51e7-9e7e-1175a8646f7a | docs | python | python_stdtypes | 315 | 96 | str.rjust(*width*, *fillchar=' '*, */*)[¶](#str.rjust "Link to this definition")
: Return the string right justified in a string of length *width*. Padding is
done using the specified *fillchar* (default is an ASCII space). The
original string is returned if *width* is less than or equal to `len(s)`.
str.rpa... | large_dataset/raw/docs/python/stdtypes/stdtypes_315.md |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.