-
print(*objects, sep=' ', end='/n') -
len(s)- length of string or collection -
type(obj) -
id(object)- object's identity ("hashcode") -
input([prompt])- read value from CLI -
open(file)- read file -
range([start], stop, [step]) -
reversed(seq)- reverse a sequence -
sorted(seq) -
eval(expr, globals, locals)- evaluate Python expressionx = 100 res = eval("x * 2")
all(iterable)any(iterable)
abs(x)max(args*),min(args*)pow(base, exp, [mod])round(number, [places])sum(iterable)
bin(x)- integer to binary string (bin(3)->0b11)bool([x])- convertsxto bool, see Truth Value Testingchr(i)- Unicode code point to string charactercomplex([real, [imag]])- complex numbersfloat([x])hex(x)- integer to hex string (bin(16)->0xa)int([x], base=10)- number or string to intord(s)- string character to Unicode code pointstr(o)- object to string
- bytearray
- bytes
- dict
- frozenset
- list
- set
- tuple
dir([obj])- names in the current scope, or object attributes (__dirs__)vars([obj])- attributes and their values (__dict__)help(func)- function docshasattr(obj, name),getattr(object, name),setattr(object, name, value)issubclass(class, classinfo),isinstance(obj, classinfo)
map(func, iterable)- supports multiple iterables -> multiple arguments for the function- accepts
iterable, returnsiterator(akamap object)
- accepts
filter(func, iterable)zip(*iterables)