Complete sorting of python built-in functions and python built-in functions
Python has many built-in functions and types that you can use at any time. The following lists them in alphabetical order.
1
abs
(X)
Returns the absolute value of a number. The parameter can be an integer or a floating point number. If the parameter is a complex number, its modulo is returned.
2
3
any
(Iterable)
WhenIterableIf the element is True, True is returned. IfIterableIf it is null, False is returned. Equivalent:
4
ascii
(Object)
Just like a functionrepr()
Returns a printable string of the input object, but removes non-ASCII characters from the returned string.repr()
Encoding is used in the generated string.\x
,\u
Or\U
Prefix. The string generated by this function correspondsrepr()
Functions are similar.
5
bin
(X)
Converts an integer to a binary string. The result is an available Python expression. IfXNot in Pythonint
Type, You need to define__index__()
Returns an integer.
6
bool
([X])
Converts a value to a boolean type and uses the standard true value to determine the process. IfXIs false or does not exist, will returnFalse
Otherwise, returnTrue
.bool
It is also a class, yesint
Subclass,bool
The class cannot be any other subclass. Its only instance isFalse
AndTrue
.
7
bytearray
([Source[,Encoding[,Errors])
Returns a new byte array. Thisbytearray
Type is a variable integer sequence in the range of 0 <= x <256. It has a common method for most variable sequences described in the variable sequence type, andbytes
Type has most of the methods.
OptionalSourceParameters can be initialized in several different ways:
If no parameter is specified, an array with a size of 0 is created.
1: If yesString, You must also provideEncoding(And optional)Error) Parameter;bytearray()
Then convert the string to bytestr.encode()
.
2: If it isIntegerThe array will have this size and will be initialized with NULL bytes.
3: if it is consistentBuffer ZoneInterface, the read-only buffer of the object will be used to initialize the byte array.
4: If it isIteratableIt must be an iteration of integers in the range and they are used as the initial content of the array.0 <= x < 256
8
bytes
([Source[,Encoding[,Errors])
Returns a new "Byte" object, which is an integer sequence in an unchangeable range. Is an unchangeable version-it has the same non-Variant Method and same indexing and slicing behavior.0 <= x < 256
Therefore, the constructor parameters are interpretedbytearray()
. Byte objects can also be created using text.
9
callable
(Object)
True
IfObjectThe parameters are displayed as callable,False
Returns. If true is returned, the call fails, but if false, the call fails.ObjectIt will never succeed. Note that classes are callable (call a class to return a new instance); if their classes have__call__()
Method, then this instance can be called
New Features of version 3.2:
New Feature in version 3.2: this feature is first deleted in Python 3.0 and then brought back in Python 3.2.
10
chr
(I)
The return value indicates that the Unicode code point is an integer.I. For example,chr(97)
Returns a string.'a'
. This is the oppositeord()
. The valid range of the parameter is from 0 to 1,114,111 (base on 16 0x10FFFF ).ValueError
IfMeOutside this range, it will be proposed.
Note that in a narrow Unicode version, the result is a string of 2 characters.MeIt must be greater than 65535 (hexadecimal format of 0xFFFF ).
11
classmethod
(Function) returns a class method for the function.
The class method receives the class as the first implicit parameter, just as the instance method receives the instance. To declare the method of a class, use this idiom:
Class C: @ classmethod def f (cls, arg1, arg2 ,...
The@classmethod
The form is a function decoration-see the function definition to describe the details of the function definition.
It can beC.f()
) Or instance (suchC().f()
. This instance is ignored except its class. If the class method is called for a derived class, the derived class object is passed as the first implicit parameter.
The class method is different from the C ++ or Java static method. If you want this, seestaticmethod()
This section.
For more information about class methods, see the standard type hierarchy in the standard level documentation.
12
compile
(Source,Filename,Mode,Flags = 0,Dont_inherit = False,Optimize =-1)
Compile the source code into code or AST object. Code objects can be exec () or eval (). The source can be a string or an AST object. For more information about how to use ast objects, see the module documentation.
This file name parameter should be read from the code. If it is not read from the file ('<string>' is usually used), some identifiable values will be passed.
This mode parameter specifies what code must be compiled; it can be 'exec '. If the source contains a sequence of statements,'eval'
If it is expressed by a single, or'single'
If it is declared by a single interactive statement (in the latter case, the calculation result is a statementNone
Will be printed ).
Optional parameter flags and dont_inherit control which future statements affect source compilation. If neither of them exists (or both are zero), the code will be compiled together with the future statements in the code that is calling compile. IfFlagsThe parameter is given andDont_inheritIf it is not (or zero ),FlagsFuture statements specified by the parameter and the statements to be used. IfDont_inheritIs a non-zero integerFlagsThis parameter is the parameter-future declarations around compilation calls will be ignored.
In the future, you can use bitwise OR to specify the bit of multiple statements. Specify the bit fields required for the specified feature ascompiler_flag
Property found._Feature
__future__
ParametersOptimizeSpecify the compiler optimization level; default value of the option-1
Select the interpreter optimization level-O
. Explicit level is0
(Not optimized;__debug__
Yes ),1
(Assertions are deleted,__debug__
Is false) or2
(Docstrings is also deleted ).
SyntaxError
If the compilation source is invalid andTypeError
This function is triggered when the source contains NULL bytes.
Note:
Input code in multiple lines'single'
Or'eval'
When compiling a string in mode, the input must be terminated by at least one line break. This is to facilitatecode
Module to detect incomplete and complete statements.
In version 3.2, change:
Change in version 3.2: allow the use of Windows and Mac line breaks. In'exec'
In this mode, the input does not end with a line break. Added optimization parameters.
The built-in function is now ......
Today's speech
It is difficult to stick to one thing. Maybe you want to do it well, but there are always many reasons for you to give up and tell yourself that it doesn't matter. Over time, you have a bad attitude. You are common, not for no reason.
Recommended reading:
Python Learning
Elegant Python
Excel tutorial using python
Make your Python code elegant and authentic
Python notes
Python Study Notes
Python: Python iterator and Generator
Python Functions
Python common module Materials
Python Zen Road
Python string operations
Python encoding naming rules
Differences between del, remove, and pop in python Arrays
Machine Learning
Machine learning basics-Series 2
Summary of random data generation of machine learning algorithms
Python data cleansing
Python data cleansing
Want to get started with deep learning? Understand these 25 concepts first!
Attention Model in natural language processing: What is and why?
User profiling-user gender recognition
Machine learning basics-Series 1
Customer churn analysis
Global warming Temperature Analysis
Data Mining learning notes-Decision Tree C4.5
What time do you know about decision trees?
Python implementation of decision tree
Machine Learning ------ K-Means (K-Means)
Machine Learning Algorithms and Python practices (I) k-nn)
Complete data science learning path
Learning linear regression, logistic regression, and various regression concepts
From: http://docspy3zh.readthedocs.io/en/latest/library/functions.html