Python Builtin Functions
Python provides functions, that comes directly within the language, for some of the trivial scenarios.
To be precise, there are 70 builtin functions in Python.
Tutorials
In each of the following tutorial, we discuss the syntax of the function and explain its usage with the help of examples.
Builtin Functions
- abs() This function is used to find the absolute value of given number.
- all() This function is used to check if all elements of the given iterable are true.
- any() This function is used to check if at least one of the elements of the given iterable is/are true.
- ascii() This function is used to find printable representation of the given object.
- bin() This function is used to find binary string prefixed with
0b
for given integer. - bool() This function is used to convert given argument to a boolean value.
- breakpoint() This function takes the execution into the debugger.
- bytearray() This function is used to create a byte array from given source, based on specified encoding.
- bytes() This function is used to to create bytes object from given source.
- callable() This function is used to check if given object is callable or not.
- chr() This function is used to convert the given unicode code point to a string (with a single character).
- classmethod This is a function decorator. When this decorator is given for a method, then the method is transformed into a class method.
- compile() This function is used to compile the given source code.
- complex() This function is used to create a complex number (real + imaginary).
- delattr() This function is used to delete a specified attribute from given object.
- dict() This function is used to create a dictionary from given iterable, or keyword arguments.
- dir() This function is used to get the list of attributes for given object.
- divmod() This function is used to find the quotient and remainder for given two numbers.
- enumerate() This function is used to create an enumerate object from given iterable.
- eval() This function is used to evaluate given string as a Python expression.
- exec() This function is used to execute given string as Python code.
- filter() This function is used to filter given iterable based a function that returns True or False for each element in the iterable.
- float() This function is used to create a floating point number.
- format() This function is used to format the given value based on the specified format specification.
- frozenset() This function is used to create a frozen set from given iterable.
- getattr() This function is used to find the value of given attribute in an object.
- globals() This function is used to get the dictionary implementing the current module namespace.
- hasattr() This function is used to check if the object has given attribute.
- hash() This function is used to get the has value of an object.
- help() This function is used to invoke Python builtin help system for a search string.
- hex() This function is used to create a hexadecimal string from given integer number.
- id() This function is used to return the id (identity) of an object.
- input() This function is used to read input from standard console input.
- int() This function is used to create an integer object from a number or string.
- isinstance() This function is used to check if given object is an instance of specified classinfo object.
- issubclass() This function is used to check if a class is a direct, indirect, or virtual subclass of specified classinfo.
- iter() This function is used to create an iterator from an object.
- len() This function is used to find the number of items in an object.
- list() This function is used to create a list from an iterable.
- locals() This function is used to get a dictionary that represents current local symbol table.
- map() This function is used to create an iterator that applies given function to every item of given iterable, yielding the results.
- max() This function is used to find the maximum of given arguments, or iterable.
- memoryview() This function is used to create a memory view that is created from given object.
- min() This function is used to find the minimum of given arguments, or iterable.
- next() This function is used to get the next item from the iterable.
- object() This function is used to create a new featureless of attribute less object.
- oct()This function is used to get the octal string representation of given integer.
- open() This function is used to open a file in specified mode.
- ord() This function is used to get the unicode code point for a character.
- pow() This function is used to find the result of a base number raised to a power.
- print() This function is used to print given object(s) to standard console output.
- property() This function is used to get the property attribute and we can optionally provide functions to get, set or delete the attribute value.
- range() This function is used to create a range object from given start value, stop value, and step value.
- repr() This function is used to get a string that contains printable representation of given object.
- reversed() This function is used to get a reverse iterable object for given sequence.
- round() This function is used to round a number to specific precision after the decimal point.
- set() This function is used to create a new set object from given iterable.
- setattr() This function is used to set an attribute of the object, with a value.
- slice() This function is used to create a slice object with given start position, stop position, and step value.
- sorted() This function is used to sort a given iterable in ascending or descending order.
- @staticmethod This decorator is used transform a method into a static method.
- str() This function is used to create a string version of given object.
- sum() This function is used to find the sum of items in the given iterable.
- super() This function is used to create a proxy object that delegates method calls to a parent or sibling class of specified type.
- tuple() This function is used to create a tuple object from an iterable.
- type() This function is used to get the type of given object.
- vars() This function is used to get the dictionary or attributes for a given module, class, instance, r any other object.
- zip() This function is used to iterate over given iterables in parallel.
- __import__() This function is used to replace the default behaviour of import statement.
Conclusion
In this Python Tutorial, we have learnt about builtin functions in Python language.