Python Built-in Functions

  • Read
  • Discuss

Here is the list of Python built-in functions:

abs()returns the absolute value of a number
all()returns True if all elements in an iterable are true
any()returns True if any element in an iterable is true
ascii()returns a string containing a printable representation of an object
bin()converts an integer to a binary string
bool()converts a value to a Boolean
breakpoint()Raises an auditing event builtins.breakpoint with argument breakpointhook
bytearray()returns an array of bytes
bytes()returns a bytes object
callable()returns True if the object is callable, False otherwise
chr()returns a string representing a character whose Unicode code point is the integer
classmethod()converts a method into a class method
compile()returns a code object from source (normal string, a bytes-like object, or an AST object)
complex()creates a complex number
delattr()deletes an attribute from an object
dict()creates a dictionary
dir()tries to return a list of valid attributes of the object
divmod()returns a pair of numbers (a tuple) consisting of their quotient and remainder
enumerate()takes an iterable object, and returns an iterator that produces tuples containing the index and the value of each element of the object
eval()runs Python code within the program
exec()also runs Python code within the program
filter()constructs an iterator from elements of an iterable for which a function returns true
float()returns a floating point number from a number or a string
format()returns a formatted version of a specified value
frozenset()returns an immutable frozenset object
getattr()returns the value of a named attribute of an object
globals()returns the current global symbol table as a dictionary
hasattr()returns true if the object has the given named attribute, false otherwise
hash()returns the hash value of an object
help()invokes the built-in help system
hex()converts an integer to a hexadecimal string
id()returns identity of an object
input()reads a line from input
int()returns an integer object from a number or a string
isinstance()returns true if the object is an instance of the specified type
issubclass()returns true if a class is a subclass of a specified class
iter()returns an iterator object
len()returns the number of items in an object
list()returns a list
locals()returns an updateable dictionary representing the current local symbol table
map()applies a function to all items in an input_list and returns a list of the results
max()returns the largest item in an iterable or

Leave a Reply

Leave a Reply

Scroll to Top