Python Built-in Functions

abs(x)

Returns the absolute value of a number.

Read more

all(iterable)

Checks if all elements of iterable are true. Returns True if all elements are true or if the iterable is empty.

Read more

any(iterable)

Checks if there is at least one true element in iterable.

Read more

ascii(object)

Replaces non-printable characters in object with their ASCII representation and returns it.

Read more

bin(x)

Converts an integer x to a binary string. If x is not an int, it must define an __index__() method that returns an integer.

Read more

bool(x=False)

Converts to bool type using standard truth-testing.

Read more

bytearray(source=b'')
bytearray(source, encoding)
bytearray(source, encoding, errors)

Returns a bytearray object, which is an array of bytes.

Read more

bytes([source[, encoding[, errors]]])

Returns a byte array. The bytes type is an immutable sequence of integers in the range 0 ≤ X < 256. Use source for initial array initialization.

Read more

callable(obj)

Returns True if obj is callable, otherwise False.

Read more

chr(i)

Returns the character for the given numeric representation. i must be a positive integer.

Read more

classmethod(function)

Represents function as a class method. A class method implicitly receives the class as its first argument, similar to how an instance method receives the instance.

Read more

compile(source, filename, mode, flags=0, dont_inherit=False, optimize=-1)

Compiles source code into a code object or an abstract syntax tree (AST) object. The code object can be executed using eval or exec.

Read more

complex([real[, imag]])

Returns a complex number with the value real + imag * 1j or converts a string to a complex number if the first argument is a string.

Read more

delattr(object, name)

Deletes the attribute name from object. The attribute will be deleted if the object supports this action.

Read more

dir()
dir(object)

Returns the attributes of object in alphabetical order. When called without an argument, it returns the names of variables available in the local scope.

Read more

dict(**kwargs)
dict(mapping, **kwargs)
dict(iterable, **kwargs)

Creates a dictionary in Python.

Read more

divmod(a, b)

Takes two numbers as arguments and returns their quotient and remainder as a tuple.

Read more

enumerate(sequence, start=0)

Returns an iterator that yields pairs of counter-element for elements in sequence. Set the initial value of the counter with start.

Read more

eval(expression, globals=None, locals=None)

Parses and executes the expression passed to it.

Read more

exec(object, globals=None, locals=None, /, *, closure=None)

Dynamically executes the code object.

Read more

filter(function, iterable)

Filters elements of iterable using the specified function.

Read more

format(value, format_spec='')

Formats the specified value.

Read more

frozenset([iterable])

Returns an immutable set.

Read more

getattr(object, name)

getattr(object, name, default)

Returns the value of the named attribute of an object. If not found, returns the default value provided.

Read more

globals()

Returns a dictionary of the global symbol table defined in a module.

Read more

hasattr(object, name)

Returns True if object has the specified named attribute, otherwise False.

Read more

hash(object)

Returns the hash of the specified object.

Read more

hex(x)

Converts an integer to its corresponding hexadecimal string.

Read more

id(object)

Returns the identifier of the specified object.

Read more

input()

input(prompt)

Reads and returns a string of input data.

Read more

int(x=0)

int(x, base=10)

Converts x to an integer in the decimal system. Any base from 2 to 36 inclusive can be specified.

Read more

__import__(name, globals=None, locals=None, fromlist=(), level=0)

Function called by the import statement.

Read more

iter(object)

iter(object, sentinel)

Returns an iterator object.

Read more

isinstance(object, classinfo)

Checks if an object is an instance or subclass of a class classinfo.

Read more

issubclass(class, classinfo)

Returns whether the specified class is a subclass of classinfo.

Read more

len(s)

Returns the number of elements in the specified container.

Read more

list

list(iterable)

Creates a list.

Read more

locals()

Returns a dictionary representing the current local symbol table.

Read more

map(function, iterable, *iterables)

Applies the specified function to each element of the specified sequence (s).

Read more

max(iterable, *, key=None)

max(iterable, *, default, key=None)

max(arg1, arg2, *args, key=None)

Returns the element with the highest value from those passed to the function.

Read more

memoryview(object)

Returns a memory view object for the given argument.

Read more

min(iterable, *, key=None)

min(iterable, *, default, key=None)

min(arg1, arg2, *args, key=None)

Returns the element with the lowest value from those passed to the function.

Read more

next(iterator)

next(iterator, default)

Returns the next element of the iterator.

Read more

object()

Returns a featureless object that is the base for all objects.

Read more

open(file, mode='r', buffering=-1, encoding=None, errors=None, newline=None, closefd=True, opener=None)

Opens a file and returns a corresponding file object.

Read more

ord(c)

Returns the numeric representation for the specified character.

Read more

pow(base, exp, mod=None)

Returns the result of raising a number to a power, with optional modulus division.

Read more

print(*objects, sep=' ', end='\n', file=None, flush=False)

Prints the specified objects to the screen or sends them as a text stream to a file.

Read more

property(fget=None, fset=None, fdel=None, doc=None)

Returns a property attribute.

Read more

range(stop)

range(start, stop, step=1)

An arithmetic progression from start to stop with a step of step.

Read more

repr(object)

Returns a formal string representation of the specified object.

Read more

reversed(seq)

Returns a reverse iterator over the specified sequence seq.

Read more

round(number, ndigits=None)

Returns a floating-point number rounded to the specified number of decimal places.

Read more

set

set(iterable)

Creates a set.

Read more

setattr(object, name, value)

Adds the specified attribute to an object.

Read more

sorted(iterable, *, key=None, reverse=False)

Returns a new sorted list from the elements of the iterable.

Read more

str(object='')

str(object=b'', encoding='utf-8', errors='strict')

Returns a string representation of an object.

Read more

vars()

vars(object)

Returns the dictionary of the dict attribute of the specified object.

Read more

zip(*iterables, strict=False)

Returns an iterator of tuples, where the i-th tuple contains the i-th element from each of the specified sequences.

Read more