String API Reference
Python str methods for manipulating text — splitting, replacing, searching, formatting and transforming strings.
str
Built-in string type. Immutable sequence of Unicode code points.
str.split(sep=None, maxsplit=-1)Return a list of substrings split at sep. If sep is None, splits on any whitespace and discards empty strings.
Returns: list[str]
str.replace(old, new, count=-1)Return a copy with all occurrences of substring old replaced by new.
Returns: str
str.find(sub[, start[, end]])Return the lowest index where sub is found, or -1 if not found. Does not raise.
Returns: int
str.format(*args, **kwargs)Format the string using replacement fields {0}, {name}, etc. Predecessor of f-strings.
Returns: str
str.join(iterable)Concatenate the strings in iterable, using the string as separator.
Returns: str
str.strip([chars])Return a copy with leading and trailing characters removed. Default removes whitespace.
Returns: str
str.startswith(prefix[, start[, end]])Return True if the string starts with prefix.
Returns: bool
str.endswith(suffix[, start[, end]])Return True if the string ends with suffix.
Returns: bool
str.upper()Return a copy with all cased characters converted to uppercase.
Returns: str
str.lower()Return a copy with all cased characters converted to lowercase.
Returns: str