Function / Method
len(x)
[Link](value)
[Link](value)
[Link](value)
value in x
[Link](prefix)
[Link](suffix)
[Link](sep)
[Link](list)
[Link]()
[Link](old, new)
min(x)
max(x)
sorted(x)
reversed(x)
[Link]()
[Link]()
[Link]()
[Link]()
[Link]()
list(x)
tuple(x)
set(x)
enumerate(x)
zip(a, b, …)
map(func, x)
filter(func, x)
What it does
Returns the length
Returns first index where value appears; error if missing
Returns index or -1 if missing
Counts occurrences
Checks membership
Checks whether string begins with prefix
Checks whether string ends with suffix
Splits string into list
Joins list into string
Removes whitespace from both ends
Replaces substring
Smallest element
Largest element
Returns a sorted list
Returns reverse iterator
Converts to uppercase
Converts to lowercase
Checks if all characters are digits
Checks if all characters are letters
Letters or digits
Converts iterable → list
Converts iterable → tuple
Converts iterable → set (removes duplicates)
Gives index + value pairs
Combines sequences element-wise
Applies func to each element
Keeps items where func returns True
Works for
strings, lists, tuples, sets, dicts, any sized object
strings, lists, tuples
strings only
strings, lists, tuples
strings, lists, tuples, sets, dicts (checks keys)
strings
strings
strings
strings (as the separator)
strings
strings
strings, lists, tuples (comparable elements)
strings, lists, tuples
any iterable with comparable elements
strings, lists, tuples
strings
strings
strings
strings
strings
strings, tuples, sets, any iterable
same as above
same as above
strings, lists, tuples
any iterables
any iterable
any iterable
What it returns
int
int
int
int
bool
bool
bool
list of str
str
str
str
element (same type as elements of x)
element (same type as elements of x)
list
iterator
str
str
bool
bool
bool
list
tuple
set
enumerate object (iterator of tuples (index, value))
zip object (iterator of tuples)
map object (iterator)
filter object (iterator)
Method What it does
[Link]() First letter uppercase
[Link]() Every word capitalized
[Link](value) Rightmost index, or -1
[Link](sep) Splits into (before, sep, after)
[Link](sep) Split from the right
format() / f"{x}" String formatting
Works for What it returns
strings str
strings str
strings int
strings tuple of 3 str (before, sep, after)
strings list of str
strings str
Function What it does
any(x) True if any element is True
all(x) True if all elements are True
sum(x) Sums numbers
Works for What it returns
any iterable bool
any iterable bool
lists, tuples, sets (numeric) numeric (int or float, depending on elements)
g on elements)
Function / Method
[Link]()
[Link]()
[Link]()
datetime(year, month, day, ...)
date(year, month, day)
timedelta(...)
[Link](string, format)
[Link](format)
[Link]()
[Link](ts)
now + timedelta(...)
[Link]()
[Link]()
[Link]()
[Link]()
[Link]()
[Link](year, month)
[Link](year, month)
What it does
Current local date & time
Current UTC date & time
Current date only
Create a datetime manually
Create a date manually
Time differences (days, seconds, etc.)
Convert string → datetime
Convert datetime → string
Convert datetime → Unix timestamp
Convert timestamp → datetime
Add/subtract time
Extract date from datetime
Extract time from datetime
Mon=0 … Sun=6
Mon=1 … Sun=7
ISO-8601 string
Text calendar
Returns (weekday_of_first_day, num_days)
Works for What it returns
datetime module datetime object
datetime datetime object
date date object
datetime datetime object
date date object
datetime, timedelta timedelta object
datetime datetime object
datetime str
datetime float (Unix timestamp)
datetime datetime object
datetime, timedelta datetime object
datetime date object
datetime time object
datetime int (0–6)
datetime int (1–7)
datetime str
calendar module str (text calendar)
calendar tuple (weekday_of_first_day, num_days)