- Python Built-in Functions
- Python Built-in Functions
- Python abs()
- Python all()
- Python any()
- Python ascii()
- Python bin()
- Python bool()
- Python bytearray()
- Python bytes()
- Python callable()
- Python chr()
- Python classmethod()
- Python compile()
- Python complex()
- Python delattr()
- Python dict()
- Python dir()
- Python divmod()
- Python enumerate()
- Python eval()
- Python exec()
- Python filter()
- Python float()
- Python format()
- Python frozenset()
- Python getattr()
- Python globals()
- Python hasattr()
- Python hash()
- Python help()
- Python hex()
- Python id()
- Python input()
- Python int()
- Python isinstance()
- Python issubclass()
- Python iter()
- Python len()
- Python list()
- Python locals()
- Python map()
- Python max()
- Python memoryview()
- Python min()
- Python next()
- Python object()
- Python oct()
- Python open()
- Python ord()
- Python pow()
- Python print()
- Python property()
- Python range()
- Python repr()
- Python reversed()
- Python round()
- Python set()
- Python setattr()
- Python slice()
- Python sorted()
- Python staticmethod()
- Python str()
- Python sum()
- Python super()
- Python tuple()
- Python type()
- Python vars()
- Python zip()
- Python __import__()
Python Built-in Functions
The following table lists all the built-in functions of Python 3.
Function | Description |
---|---|
abs() | Returns the absolute value of the given number and returns a magnitude of a complex number. |
all() | Checks whether all the elements in an iterable are truthy values or not. It returns True if all elements in the given iterable are nonzero or true. Else, it returns False. |
any() | Returns True if at least one element in the given iterable is truthy value or boolean True. Returns False for empty or falsy value (such as 0, False, none). |
ascii() | Returns a string containing a printable representation of an object for non-alphabats or invisible characters such as tab, carriage return, form feed etc. |
bin() | Converts an integer number to a binary string prefixed with ‘0b’. |
bool() | Converts a value to the bool class object containing either True or False |
bytearray() | Returns a bytearray object which is an array of the given bytes. The bytearray class is a mutable sequence of integers in the range of 0 to 256. |
bytes() | Returns an immutable object of the bytes class initialized with the sequence of integers in the range of 0 to 256 |
callable() | Returns True if the object passed is callable, False if not. In Python, classes, methods, and instances are callable because calling a class returns a new instance, instances are callable if their class includes `__call__()` method. |
chr() | Returns the string representing a character whose Unicode code point is the integer |
classmethod() | Transforms a method into a class method |
complex() | Returns a complex number (an object of complex class) for the provided real value and imaginary*1j value, or converts a string or number to a complex number. |
dict() | Creates a dictionary object from the specified keys and values, or iterables of keys and values or mapping objects. |
delattr() | Deletes the named attribute from the object if the object allows it. |
dir() | Returns a list of valid attributes of the specified object. If no argument passed, it returns the list of names in the current local scope. |
divmod() | Returns a tuple of two numbers where first number is the quotient and the second is the remainder. |
exec() | Executes the Python code block passed as a string or a code object. The string is parsed as Python statements and then executed. |
enumerate() | Returns an object of enumerate class for the given iterable, sequence, iterator, or object that supports iteration. The returned enumerate object contains tuples for each items of the iterable that includes an index (from start which defaults to 0) and the values obtained from iterating over iterable. |
filter() | Calls the specified function which returns boolen for each item of the specified iterable. |
float() | Returns an object of the `float` class that represent a floating point number converted from a number or string. |
format() | Allows multiple substitutions and value formatting. This method lets us concatenate elements within a string through positional formatting. |
frozenset() | Returns an immutable set object with elements from the given iterable. Iterables can be list, set, dictionary, tuple, string. |
getattr() | Returns the value of the attribute of an object. If the named attribute does not exist, default is returned if provided, otherwise AttributeError is raised. |
hex() | Converts an integer number to a lowercase hexadecimal string prefixed with «0x». |
hash() | Returns the hash value of the specified object. The hash values are used in data storage and to access data in a small time per retrieval, and storage space only fractionally greater than the total space required for the data or records themselves. In Python, has values are used to compare dictionary keys to access values. |
hasattr() | Checks if an object of the class has the specified attribute. |
help() | It displays the documentation of modules, functions, classes, keywords etc. |
__import__() | The __import__() method is called by the import statement. This method can change the semantics of the import statement which is strongly discouraged . |
id() | Returns an identity of an object. In Python, every variable or literal values are objects and each object has a unique identity as an integer number that remains constant for that object through out its life time. |
int() | Returns an integer object constructed from a number or string, or return 0 if no arguments are given. |
input() | Allows user to input values. |
isinstance() | Checks if the object is an instance of the specified class or any of its subclass. |
issubclass() | Checks if the specified class is the subclass of the specified subclass. |
iter() | Returns an iterator object that represents a stream of data for the iterable object or sentinel. |
len() | Returns the length of the object. Returns total elements in an iterable or number of chars in a string. |
list() | Returns a list from an iterable passed as arguement. |
map() | Applies the specified function to every item of the passed iterable, yields the results, and returns an iterator. |
max() | Returns the largest value from the specified iterable or multiple arguments. |
memoryview() | Returns a memory view object of the given object. The memoryview object allows Python code to access the internal data of an object that supports the buffer protocol without copying. |
min() | Returns the lowest value from the specified iterable or provided multiple arguments. |
next() | Returns the next item from the iterator by calling its __next__() method. |
object() | Returns a new featureless object. The object class is the base class of all classes in Python. |
oct() | Converts an integer to octal string prefixed with «0o». |
open() | Opens the file (if possible) and returns the corresponding file object. |
ord() | Returns an integer representing the Unicode character. |
pow() | Returns the specified exponent power of a number. |
print() | prints the given object to the console or to the text stream file. |
property() | Returns the property attribute. |
range() | Returns an object of the range class which is an immutable sequence type. The `range()` method returns the imutable sequence numbers between the specified start and the stop parameter. |
repr() | Returns a string containing a printable representation of an object. The repr() function calls the underlaying __repr__() function of the object. |
reversed() | Returns the reversed iterator of the given sequence. It is same as but in reverse order. Internally, it calls the `__reversed__()` method of the sequence class. If the given object is not a sequence, then override __reversed__() method in the class to be used with the reversed() function |
round() | Returns a floating-point number rounded to the specified number of decimal point. |
set() | Returns an object of the set class from the specified iterable and its elements. A set object is an unordered collection of distinct hashable objects. It cannot contain duplicate values. Visit [set](‘/python/set’) for more information. |
setattr() | Sets the specified value to the specified attribute of the specified object. This is the counterpart of getattr() method. |
slice() | Returns a portion of an iterable as an object of the slice class based on the specified range. It can be used with string, list, tuple, set, bytes, or range objects or custom class object that implements sequence methods __getitem__() and __len__() methods. |
sorted() | Returns a sorted list from the items in an iterable. |
str() | Returns an object of the str class with the specified value. |
sum() | Returns the total of integer elements starting from left to right of the given iterable. |
super() | Returns a proxy object that allows us to access methods of the base class. |
tuple() | Creates an empty tuple or converts the specified iterable to a tuple. |
type() | Either returns the type of the specified object or returns a new type object of the specified dynamic class, based on the specified class name, base classes and class body. |
vars() | Returns the __dict__ attribute of the specified object. A __dict__ object used to store an object’s writable attributes. |
zip() | Takes iterables, aggregates them in a tuple, and return it. |
TutorialsTeacher.com is optimized for learning web technologies step by step. Examples might be simplified to improve reading and basic understanding. While using this site, you agree to have read and accepted our terms of use and privacy policy.
Subscribe to TutorialsTeacher email list and get latest updates, tips & tricks on C#, .Net, JavaScript, jQuery, AngularJS, Node.js to your inbox.
Python Built-in Functions
Python has several functions that are readily available for use. These functions are called built-in functions. On this reference page, you will find all the built-in functions in Python.
Python abs()
returns absolute value of a number
Python all()
returns true when all elements in iterable is true
Python any()
Checks if any Element of an Iterable is True
Python ascii()
Returns String Containing Printable Representation
Python bin()
converts integer to binary string
Python bool()
Converts a Value to Boolean
Python bytearray()
returns array of given byte size
Python bytes()
returns immutable bytes object
Python callable()
Checks if the Object is Callable
Python chr()
Returns a Character (a string) from an Integer
Python classmethod()
returns class method for given function
Python compile()
Returns a Python code object
Python complex()
Python delattr()
Deletes Attribute From the Object
Python dict()
Python dir()
Tries to Return Attributes of Object
Python divmod()
Returns a Tuple of Quotient and Remainder
Python enumerate()
Returns an Enumerate Object
Python eval()
Runs Python Code Within Program
Python exec()
Executes Dynamically Created Program
Python filter()
constructs iterator from elements which are true
Python float()
returns floating point number from number, string
Python format()
returns formatted representation of a value
Python frozenset()
returns immutable frozenset object
Python getattr()
returns value of named attribute of an object
Python globals()
returns dictionary of current global symbol table
Python hasattr()
returns whether object has named attribute
Python hash()
returns hash value of an object
Python help()
Invokes the built-in Help System
Python hex()
Converts to Integer to Hexadecimal
Python id()
Returns Identify of an Object
Python input()
reads and returns a line of string
Python int()
returns integer from a number or string
Python isinstance()
Checks if a Object is an Instance of Class
Python issubclass()
Checks if a Class is Subclass of another Class
Python iter()
Python len()
Returns Length of an Object
Python list()
Python locals()
Returns dictionary of a current local symbol table
Python map()
Applies Function and Returns a List
Python max()
Python memoryview()
returns memory view of an argument
Python min()
returns the smallest value
Python next()
Retrieves next item from the iterator
Python object()
creates a featureless object
Python oct()
returns the octal representation of an integer
Python open()
Python ord()
returns an integer of the Unicode character
Python pow()
returns the power of a number
Python print()
Python property()
returns the property attribute
Python range()
returns a sequence of integers
Python repr()
returns a printable representation of the object
Python reversed()
returns the reversed iterator of a sequence
Python round()
rounds a number to specified decimals
Python set()
constructs and returns a set
Python setattr()
sets the value of an attribute of an object
Python slice()
Python sorted()
returns a sorted list from the given iterable
Python staticmethod()
transforms a method into a static method
Python str()
returns the string version of the object
Python sum()
Adds items of an Iterable
Python super()
Returns a proxy object of the base class
Python tuple()
Python type()
Returns the type of the object
Python vars()
Returns the __dict__ attribute
Python zip()
Returns an iterator of tuples
Python __import__()
Function called by the import statement