This page provides you with Python built-in functions and types for references.
Name | Meaning |
---|---|
abs(x) | Return an absolute value of a number |
all(iterable) | Return True if all elements of the iterable are true |
any(iterable) | Return True if any element of the iterable is true |
ascii() | Return a string that contains a printable representation of an object |
bin() | Convert an integer to a binary string prefixed with 0b |
bool(x) | Return a Boolean value, either True or False of x |
bytearray() | Return a new array of bytes |
bytes([source[, encoding[, errors]]]) | Return a new bytes object that is an immutable sequence of integers in the range [0,256] |
callable(object) | Return True if the object is callable, False otherwise |
chr(i) | Return the string representing a character whose Unicode code point is the integer i |
@classmethod | Transform a method into a class method. |
delattr(object, name) | Delete the attribute specified by name from the object if the object allows it. |
dict() | Create a new dictionary |
dir([object]) | Return a list of names in the current local scope or return a list of valid attributes of the object if the object is specified. |
divmod(a,b) | Accept two numbers and return a tuple of two numbers that consists of their quotient and remainder when using integer division. For integers, the result is the same as (a // b, a % b) |
enumerate() | Iterate over an iterable with a counter |
eval(expression[, globals[, locals]]) | Run the Python expression with the optional globals and locals |
exec(object[, globals[, locals]]) | Dynamically execute Python code with the optional globals and locals |
filter() | Filter elements of a list |
float(x) | Convert a string or a number (x ) into a floating point number |
format(value[, format_spec]) | Convert the value to a formatted representation, as controlled by format_spec . |
frozenset([iterable]) | Return a new frozenset object with elements from the iterable |
getattr(object, name[, default]) | Return the value of the name attribute of the object or default if the name attribute doesn’t exist. |
globals() | Return a dictionary that contains all global variables in the current module |
hasattr(object, name) | Return True if the object has an attribute specified by name or False otherwise. |
hash() | Return the value as an integer of an object. Python uses the hash values to quickly compare dictionary keys for faster lookup. |
help([object]) | Call the built-in help system |
hex(x) | Convert an integer (x ) to a lowercase hexadecimal string prefixed with 0x . |
id(object) | Return an integer which is an identity of an object |
input([prompt]) | Read a line from the input, convert it to a string (removing a trailing newline), and return that string. |
int() | Convert a string or a number to an integer |
isinstance(object,classinfo) | Return true of the object is an instance of the classinfo or an instance of a subclass of the classinfo . |
issubclass(class,classinfo) | Return True if the class is a subclass of classinfo . |
iter() | Return an iterator of a given object |
len(s) | Return the length (or the number of items) of an object. |
list([iterable]) | Return a List object from the iterable |
locals() | Update and return a dictionary that stores the current local symbol table. |
map(function, iterable,…) | Return an iterator that contains the results of when applying the function to every item of iterable . |
max(iterable, [, key, default]) max(arg1, arg2, *args, [,key]) | Return the largest item in an iterable or the largest of two or more arguments. |
min(iterable, [, key, default]) min(arg1, arg2, *args, [,key]) | Return the smallest item in an iterable or the smallest of two or more arguments |
next(iterator[, default]) | Return the next item from the iterator . |
object() | Return the object that is the base object of all other objects |
oct(x) | Convert an integer to an octal string prefixed with 0o |
open() | Open a file and return a file object. |
ord(c) | Return an integer that represents the Unicode code point of the character c . |
pow(base, exp[, mod]) | Return base to the power exp . If the mod is available, return the (base**exp) % mod . The calculation is more efficient than pow(base, exp) % mod |
print() | Print objects to the text stream file , separated by sep and followed by end . |
property() | Return a property attribute |
range(stop) range(start, stop[, step]) | Return an immutable sequence object |
repr(object) | Return a string that contains the printable representation of an object. |
reversed(seq) | Return a reverse of a sequence specified by seq |
round(number[, ndigits]) | Return the number rounded to ndigits precision after the decimal point. |
set([iterable]) | Return a new Set object |
setattr(object, name, value) | Set the value to the name attribute of the object i.e., object.name = value |
slice(start, stop[, step]) | Return a slice object |
sorted() | Return a sorted list of items from the iterable. |
@staticmethod | Transform a method into a static method |
str() | Return the string version of an object |
sum(iterable, / , start=0) | Return the total of the start with all items of an iterable from left to right. |
super(type) | Return a proxy object that can delegate calls to methods of a parent or sibling class of type |
tuple([iterable]) | Create a tuple from an iterable |
type(object) | Return the type of an object |
vars(object) | Return the __dict__ attribute of any object (e.g., a module, a class, an instance,..) with a __dict__ attribute. |
zip(*iterables, strict=False) | Iterate over multiple iterables in parallel and make tuples with an item from each iterable. |
__import__() | The __import__() is invoked by the import statement to change its effects. It is not recommended to use the __import__() function directly. |
Did you find this tutorial helpful ?