Built-in Functions in Python (2024)
Note: Some functions have minimal changes compared to Python 2.x. They may directly link to the built-in function explanations in the Python 2.x tutorial, so be sure to pay attention to the details.
The following are Python's built-in functions:
Function | Description |
---|---|
abs() | Returns the absolute value of a number. |
all() | Returns True if all elements of the iterable are true. |
any() | Returns True if any element of the iterable is true. |
ascii() | Returns a readable version of an object, replacing non-ASCII characters with escape sequences. |
bin() | Converts an integer to its binary equivalent. |
bool() | Converts a value to True or False . |
bytearray() | Returns an array of bytes. |
bytes() | Returns an immutable bytes object. |
callable() | Returns True if the object appears callable, otherwise returns False . |
chr() | Returns the string representation of a character from its Unicode code. |
classmethod() | Converts a method into a class method. |
compile() | Compiles source into a code or AST object. |
complex() | Returns a complex number. |
delattr() | Deletes an attribute from an object. |
dict() | Creates a new dictionary. |
dir() | Attempts to return a list of valid attributes of an object. |
divmod() | Returns a pair of numbers (quotient, remainder). |
enumerate() | Returns an enumerate object. |
eval() | Evaluates a Python expression. |
exec() | Executes the Python code. |
filter() | Constructs an iterator from elements of an iterable for which a function returns true. |
float() | Converts a string or a number to a floating-point number. |
format() | Returns a formatted representation of a value. |
frozenset() | Returns a new frozenset object. |
getattr() | Returns the value of the named attribute of an object. |
globals() | Returns the global symbol table as a dictionary. |
hasattr() | Returns True if the object has the given named attribute. |
hash() | Returns the hash value of an object. |
help() | Invokes the built-in help system. |
hex() | Converts an integer to its hexadecimal equivalent. |
id() | Returns the identity of an object. |
input() | Reads a line of input from the user. |
int() | Converts a value to an integer. |
isinstance() | Checks if an object is an instance or subclass of a class or tuple of classes. |
issubclass() | Checks if a class is a subclass of another class. |
iter() | Returns an iterator object. |
len() | Returns the length (number of items) of an object. |
list() | Creates a new list. |
locals() | Returns the current local symbol table as a dictionary. |
map() | Applies a function to every item of an iterable. |
max() | Returns the largest item in an iterable. |
memoryview() | Returns a memory view object. |
min() | Returns the smallest item in an iterable. |
next() | Retrieves the next item from an iterator. |
object() | Returns a new featureless object. |
oct() | Converts an integer to its octal equivalent. |
open() | Opens a file and returns a corresponding file object. |
ord() | Returns the Unicode code of a character. |
pow() | Returns the value of x raised to the power of y . |
print() | Prints the given object(s) to the console. |
property() | Returns a property attribute. |
range() | Returns a sequence of numbers. |
repr() | Returns a string representation of an object. |
reversed() | Returns a reverse iterator. |
round() | Rounds a number to a specified number of digits. |
set() | Returns a new set object. |
setattr() | Sets an attribute of an object. |
slice() | Returns a slice object. |
sorted() | Returns a sorted list from the items in an iterable. |
staticmethod() | Converts a method into a static method. |
str() | Returns a string object. |
sum() | Sums the items of an iterable. |
super() | Returns a proxy object that delegates method calls to a parent or sibling class. |
tuple() | Returns a tuple object. |
type() | Returns the type of an object. |
vars() | Returns the __dict__ attribute of an object, if defined. |
zip() | Returns an iterator that aggregates elements from multiple iterables. |
__import__() | Called by the import statement. |
reload() | Reloads a previously imported module. |
This list of built-in functions provides a quick overview of the powerful tools Python offers for various operations. For more detailed explanations and examples, visit the PMeve Python Documentation.
Let me know if you need any more adjustments!