Home > Article > Backend Development > Detailed explanation of python's built-in functions
python built-in functions I have been learning python recently. I saw and learned some classifications of python built-in functions and the functions of built-in functions on the Internet. The following are Some lists of built-in functions in python. For beginners’ understanding, the classification may not be accurate. Let’s share some information.
1. Mathematical operations
abs(x) |
Find the absolute value 1. The parameter can be an integer or a complex number 2. If the parameter is a complex number, the modulus of the complex number is returned |
complex([real[, imag]]) |
Create a complex number |
pmod(a, b) |
Get the quotient and remainder respectively Note: Both integer and floating point types can be |
float([x]) |
Convert a string or number to a floating point number . If there are no parameters, it will return 0.0 |
int([x[, base]]) |
Convert a character to int type, base represents Base |
long([x[, base]]) |
Convert a character to long type |
pow(x, y[, z]) |
Returns the y power of x |
2. Collection class operations
Super class of str and unicode | cannot be called directly, but can be used as isinstance Judgment
|
Format output string | The formatting parameter sequence starts from 0, Such as "I am {0},I like {1}"
|
Returns the unicode of the given int type |
|
Returns an enumerable object, and the next() method of the object will return A tuple |
|
generates an iterator of an object, and the second parameter represents the delimiter |
|
Returns the maximum value in the set |
|
Returns the minimum value in the set |
|
Create data dictionary |
|
will Converting a collection class to another collection class |
|
set object instantiation |
|
Generate an immutable set |
|
Convert to string type |
|
Team set sorting |
|
Generate a tuple type |
|
The xrange() function is similar to range(), but xrnage() does not create a list, but returns an xrange object, which The behavior is similar to the list, but the list value is only calculated when needed. When the list is large, this feature can save us memory |
##all(iterable)
2. In particular, if it is an empty string, it returns True |
any(iterable) |
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
2. In particular, if it is an empty string, it returns False |
cmp(x, y) |
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
4. Reflection
6. Othershelp() --Help information apply(), buffer(), coerce(), intern()---These are expired built-in functions, so they are not explained7. PostscriptBuilt-in functions are generally due to frequency of use It is relatively frequent or is a meta-operation, so it is provided in the form of built-in functions. Through the classification analysis of Python's built-in functions, we can see that the basic data operations are basically some mathematical operations (except addition, subtraction, multiplication and division, of course), logical operations, Collection operations, basic IO operations, and then the reflection operations on the language itself, and string operations are also commonly used. In particular, reflection operations need to be noted. |
The above is the detailed content of Detailed explanation of python's built-in functions. For more information, please follow other related articles on the PHP Chinese website!