Skip to main content

Python Built-in Types

What are the categories of built-in types?

numeric: int, float, complex

abs()
int()
float()
complext()
divmod()
pow()

math.floor(x)
math.ceil(x)
round(x[, n])

iterator: zip(*iterables)

iterator.__iter__()
iterator.__next__()
StopIteration

generator: A function which returns a generator iterator

sequence:

text sequence: class str and string methods

str.count(sub[, start[, end]])
str.encode(encoding="utf-8", errors="strict")
str.find(sub[, start[, end]])
str.format(*args, **kwargs)
str.format_map(mapping)
str.isalnum() if any is true c.isalpha(), c.isdecimal(), c.isdigit(), or c.isnumeric()
str.isspace()
str.istitle()
str.lstrip()
str.rstrip()
str.strip([chars])
str.swapcase()

str.split(sep=None, maxsplit=-1)
str.rsplit(sep=None, maxsplit=-1)
str.removeprefix(prefix, /)
str.removesuffix(suffix, /)
str.startswith(prefix[, start[, end]])

str.partition(sep)
str.rpartition(sep)
str.replace(old, new[, count])
str.lfind(sub[, start[, end]])
str.rfind(sub[, start[, end]])
str.splitlines([keepends])

str.title()
str.translate(table)

str.upper()
str.lower()

binary sequence: bytes, bytearray, memoryview

set: set, frozenset

mapping: dict and Dictionary view objects

context manager: with generators and the contextlib.contextmanager

contextmanager.__enter__()
contextmanager.__exit__(exc_type, exc_val, exc_tb)

Other Built-in Types

Special Attributes