__add__ | |
__class__ | |
__contains__ | |
__delattr__ | |
__dir__ | |
__doc__ | |
__eq__ | |
__format__ | |
__ge__ | |
__getattribute__ | |
__getitem__ | |
__getnewargs__ | |
__gt__ | |
__hash__ | |
__init__ | |
__init_subclass__ | |
__iter__ | String is an iterable (which allows for to iterate over a string's characters). |
__le__ | |
__len__ | |
__lt__ | |
__mod__ | |
__mul__ | |
__ne__ | |
__new__ | |
__reduce__ | |
__reduce_ex__ | |
__repr__ | |
__rmod__ | |
__rmul__ | |
__setattr__ | |
__sizeof__ | |
__str__ | |
__subclasshook__ | |
capitalize , lower , upper , swapcase | |
casefold | |
center | |
count | |
encode() | returns a bytes object (encoding can be specified, is UTF-8 by default) |
endswith , startswith | Checks if the string starts with or ends with a given string. |
expandtabs | |
find , rfind | |
format | |
format() | probably what comes closest to the printf function of the C standard library. |
format_map | |
index , rindex | |
isalnum | |
isalpha | |
isascii | |
isdecimal | |
isdigit | |
isidentifier | |
islower | |
isnumeric | |
isprintable | |
isspace | |
istitle | |
isupper | |
join | |
ljust , rjust | left/right alignment of a string. Compare with zfill |
lstrip | |
maketrans | Used in conjunction with translate(…) . |
partition , rpartition | |
removeprefix | |
removesuffix | |
replace(old, new) | replaces the text sequence old with new in str . |
str.rstrip() | allows to remove aribtrary characters from the string's right side and thus can be used (almost) like Perl's chomp() function. |
split , rsplit | Returns a list from the parts of the original string that are separated by the separator. |
splitlines() | Splits a text on \r , \n or \r\n (i. e. on the traditional Unix, DOS and Mac line breaks). |
strip | |
title | |
translate(…) | |
zfill | left-pads a string with zeroes: print(str(42).zfill(5)) prints 00042 . Use str(42).rjust(5, ' ') to left pad the number with spaces. |