Built-in Functions Flashcards
Summaries of all built-in functions
abs(x)
Return the absolute value of a number.
aiter(async_iterable)
Return an asynchronous iterator for an asynchronous iterable.
all(iterable)
Return true if all elements of the iterable are true or if the iterable is empty.
anext(async_iterator[,default])
When awaited, return the next item from the given asynchronous iterator, or default if given and the iterator is exhausted.
any(iterable)
Return true if any element of the iterable is true. If the iterable is empty, return False.
ascii(object)
As repr(), return a string containing a printable representation of an object, but escape the non-ASCII characters in the string returned by repr() using \x, \u, or \U escapes.
bin(x)
Convert an integer number to a binary string prefixed with “0b”.
bool([x])
Return a boolean value, i.e. one of True or False. x is converted using the standard truth testing procedure.
breakpoint(*args, **kws)
Drops you into the debugger at the call site.
bytearray([source[, encoding[, errors]]])
Return a new array of bytes.
bytes([source[, encoding[, errors]]])
Return a new “bytes” object which is an immutable sequence of integers in the range 0 <= x < 256.
callable(object)
Return True if the object argument appears callable, False if not.
chr(i)
Return the string representing a character whose Unicode code point is the integer i.
@classmethod
Transform a method into a class method.
compile(source, filename, mode, flags=0, dont_inherit_False, optimize=- 1)
Compile the source into a code or AST object.
complex([real[, imag]])
Return a complex number with the value real + imag*1j or convert a string or number to a complex number.
delattr(object, name)
Deletes the named attribute, provided the object allows it. This is a relative of setattr().
dict(**kwarg)
dict(mapping, **kwarg)
dict(iterable, **kwarg)
Create a new dictionary.
dir([object])
Without arguments, return the list of names in the current local scope. With an argument, attempt to return a list of valid attributes for that object.
divmod(a, b)
Take two (non-complex) numbers as arguments and return a pair of numbers consisting of their quotient and remainder when using integer division.
enumerate(iterable, start=0)
Return an enumerate object.
eval(expression[, globals[, locals]])
Returns the result of the evaluated expression.
exec(object[, globals[, locals]])
This function supports dynamic execution of Python code.
filter(function, iterable)
Construct an iterator from those elements of iterable for which function returns True.
float([x])
Return a floating point number constructed from a number or string x.
format(value[, format_spec})
Convert a value to a “formatted” representation, as controlled by format_spec.
frozenset([iterable})
Return a new frozenset object, optionally with elements taken from iterable.
getattr(object, name[, default])
Return the value of the named attribute of object.