.elems() method to iterate over their characters. Examples:
+ operator instead. Comparison operators perform a lexicographical comparison; use == to test for equality.
Members
- capitalize
- count
- elems
- endswith
- find
- format
- index
- isalnum
- isalpha
- isdigit
- islower
- isspace
- istitle
- isupper
- join
- lower
- lstrip
- partition
- removeprefix
- removesuffix
- replace
- rfind
- rindex
- rpartition
- rsplit
- rstrip
- split
- splitlines
- startswith
- strip
- title
- upper
capitalize
count
sub in string, optionally restricting to [start:end], start being inclusive and end being exclusive.
Parameters
elems
[s[i] for i in range(len(s))], except that the returned value might not be a list.
endswith
sub, otherwise False, optionally restricting to [start:end], start being inclusive and end being exclusive.
Parameters
find
sub is found, or -1 if no such index exists, optionally restricting to [start:end], start being inclusive and end being exclusive.
Parameters
format
{}. Anything that is not contained in braces is considered literal text, which is copied unchanged to the output.If you need to include a brace character in the literal text, it can be escaped by doubling: {{ and }}A replacement field can be either a name, a number, or empty. Values are converted to strings using the str function.
Parameters
| Parameter | Description |
|---|---|
args | default is () List of arguments. |
kwargs | default is {} Dictionary of arguments. |
index
sub is found, or raises an error if no such index exists, optionally restricting to [start:end]``start being inclusive and end being exclusive.
Parameters
isalnum
isalpha
isdigit
islower
isspace
istitle
isupper
join
Parameters
| Parameter | Description |
|---|---|
elements | iterable of strings; required |
lower
lstrip
chars are removed. Note that chars is not a prefix: all combinations of its value are removed:
Parameters
| Parameter | Description |
|---|---|
chars | string; or None; default is None The characters to remove, or all whitespace if None. |
partition
sep and returns the resulting partition as a three-element tuple of the form (before, separator, after). If the input string does not contain the separator, partition returns (self, ”, ”).
Parameters
| Parameter | Description |
|---|---|
sep | string; required The string to split on. |
removeprefix
prefix, returns a new string with the prefix removed. Otherwise, returns the string.
Parameters
| Parameter | Description |
|---|---|
prefix | string; required The prefix to remove if present. |
removesuffix
suffix, returns a new string with the suffix removed. Otherwise, returns the string.
Parameters
| Parameter | Description |
|---|---|
suffix | string; required The suffix to remove if present. |
replace
old have been replaced with new, optionally restricting the number of replacements to count.
Parameters
rfind
sub is found, or -1 if no such index exists, optionally restricting to [start:end], start being inclusive and end being exclusive.
Parameters
rindex
sub is found, or raises an error if no such index exists, optionally restricting to [start:end], start being inclusive and end being exclusive.
Parameters
rpartition
sep and returns the resulting partition as a three-element tuple of the form (before, separator, after). If the input string does not contain the separator, rpartition returns (”, ”, self).
Parameters
| Parameter | Description |
|---|---|
sep | string; required The string to split on. |
rsplit
sep as the separator, optionally limiting the number of splits to maxsplit. Except for splitting from the right, this method behaves like split().
Parameters
rstrip
chars are removed. Note that chars is not a suffix: all combinations of its value are removed:
Parameters
| Parameter | Description |
|---|---|
chars | string; or None; default is None The characters to remove, or all whitespace if None. |
split
sep as the separator, optionally limiting the number of splits to maxsplit.
Parameters
splitlines
Parameters
| Parameter | Description |
|---|---|
keepends | bool; default is False Whether the line breaks should be included in the resulting list. |
startswith
sub, otherwise False, optionally restricting to [start:end], start being inclusive and end being exclusive.
Parameters
strip
chars are removed. Note that chars is neither a prefix nor a suffix: all combinations of its value are removed:
Parameters
| Parameter | Description |
|---|---|
chars | string; or None; default is None The characters to remove, or all whitespace if None. |