blocking way, and its implementation is simple, as is calling Apply_async, but instead of returning to Applyresult, it returns directly to the result of the worker process running: def Apply (self, Func, args= (), kwds={}): assert self._state = = RUN return Self.apply_async (func, args, Kwds). Get () above Apply/apply_ Async method, you can assign only one task to the process pool at a time, and you use the Map/map_async method if you want to assign multiple tasks to the process pool at
First, the mathematical operation classABS (x) Seek absolute value1, the parameters can be integral type, can also be plural2, if the parameter is a complex number, then return the modulus of the complexComplex ([real[, Imag]]) Create a complex numberCoerce () can be regarded as a numeric type conversion function) has two parameters, all numbers, returns a list of the two numbers, unifying the data types of the two numbers. such as coerce (1,2J), return (1+0J,2J)Divmod (A, B) separate fetch a
use LAMDA rewrite, as long as a line of code is enough.
# The x behind the lambda represents the parameter to be received by the lambda function, X + x represents the value to be returned by the lambda function >>> f = lambda x:x + x# can see that F is now also a function object >>> f
Use of Map
Map (function, iterable) receives two parameters, the first parameter represents the receipt of a function, and the second parameter represents an object tha
only one task to the process pool at a time, and you can use the Map/map_async method if you want to assign multiple tasks to the process pool at once. Let's start by looking at how the Map_async method is defined:def map_async (self, func, iterable, Chunksize=none, callback=None):Assert self._state = =RUNIfNot Hasattr (iterable,‘__len__‘): Iterable =List (
ABS (x) : Returns the absolute value of a number, which can be either shaped or floating-point.All (iterable): Returns True if the element of the iteration object is true, or an iterator object is empty.Any (iterable): If any element in the iterator object is true returns True, the iteration object is empty and false is returnedASCII (object): Returns a printable string of an input object, similar to Repr (
binding between the data item and the variable).3> using * to split a sequence to assign a valueSample: a,*b,c=[1,2,3,4,5,6], a,b,c= (1, [2, 3, 4, 5], 6)The data item is assigned by the variable by position, and all the remaining data is assigned to the variable with the * number. * The function is to split a iterable.Another function of "*" is to copy the operator, which is equivalent to multiplication sign, but the object is not limited to numbers and can be any object.4> list connotation (us
Preface: Python's built-in function provides a great convenience for programming, which is a relatively complete summary of the built-in functions of Python 3.x in order to facilitate later learning.A? ABS (x):if x is a complex number, the size of it is returnedIf an integer or floating-point number returns its absolute value1 Print (ABS ( -1)) 2 Print (ABS ( -10.01)) 3 Print #返回复数的大小?All (iterable):If all elements of
tell if an object is an iterative object? The method is judged by the iterable type of the collections module:>>> from collections Import iterable>>> isinstance (' abc ', iterable) # whether STR can iterateTrue>>> ([isinstance], iterable) # Whether the list can be iteratedTrue>>> isinstance (123,
process result in a blocking way, its implementation is simple, it is also called Apply_async, but does not return Applyresult, but directly returns the result of the worker process running:def apply (self, Func, args= (), kwds={}): assert self._state = = RUN Return Self.apply_async (func, args, Kwds). Get ()The Apply/apply_async method above allows you to assign only one task to the process pool at a time, and you can use the Map/map_async method if you want to assign multiple t
integral type, can also be plural2, if the parameter is a complex number, then return the modulus of the complex
Complex ([real[, Imag]])
Create a complex number
Divmod (A, B)
Separate fetch and remainderNote: integral, floating-point types can be
float ([x])
Converts a string or number to a float. If no parameter is returned 0.0
int ([x[, Base]])
Converts a character to an int type, and base represents the binary
a sequence that starts with 0 by default
Round (x[, N])
Rounded
Sum (iterable[, start])
Sum the Set
Oct (x)
Convert a number to 8 binary
Hex (x)
Converts an integer x to a 16-binary string
Chr (i)
Returns the ASCII character corresponding to the integer i
Bin (x)
Converts an integer x to a binary string
BOOL ([x])
Convert X to Boolean type
Summarize the built-in functions, build-in function.
First, the mathematical operation class
ABS (x)
Seek absolute value
Complex ([real[, Imag]])
Create a complex number
Pmod (A, B)
Separate fetch and remainderNote: integral, floating-point types can be
float ([x])
Converts a string or number to a float. If no parameter is returned 0.0
int ([x[, Base]])
Converts a character to an int type, and base represents the binary
remainderNote: integer and floating point types are supported.
Float ([x])
Converts a string or number to a floating point number. If no parameter exists, 0.0 is returned
Int ([x [, base])
Converts a character to the int type. base indicates hexadecimal
Long ([x [, base])
Converts a character to the long type.
Pow (x, y [, z])
Returns the Power y of x.
Range ([start], stop [, step])
Generates a sequence, starting from 0 by default.
This article describes the python built-in functions and summarizes the built-in functions, Build-in Function.
I. mathematical operations
Abs (x)
Absolute value
Complex ([real [, imag])
Create a plural number
Pmod (a, B)
Separate operator and remainderNote: integer and floating point types are supported.
Float ([x])
Converts a string or number to a floating point number. If no parameter exists, 0.0 is returned
Int ([x [, base])
Convert
First, the mathematical operation class
ABS (x)
Seek absolute value1, the parameters can be integral type, can also be plural2, if the parameter is a complex number, then return the modulus of the complex
Complex ([real[, Imag]])
Create a complex number
Divmod (A, B)
Separate fetch and remainderNote: integral, floating-point types can be
float ([x])
Converts a string or number to a float. If no parameter is returned 0.0
[Terry Note] python built-in function, terrypython
To sum up the built-in Function, Build-in Function.
I. mathematical operations
Abs (x)
Absolute Value
Complex ([real [, imag])
Create a plural number
Divmod (a, B)
Separate operator and remainderNote: integer and floating point types are supported.
Float ([x])
Converts a string or number to a floating point number. If no parameter exists, 0.0 is returned
Int ([x [, base])
Converts a ch
Python built-in functions
Python built-in functionsI. mathematical operations
Abs (x)
Absolute Value1. The parameter can be an integer or a plural value.2. If the parameter is a plural value, the modulo of the plural value is returned.
Complex ([real [, imag])
Create a plural number
Divmod (a, B)
Separate operator and remainderNote: integer and floating point types are supported.
Float ([x])
Converts a string or number to a floating point number.
([real[, Imag]])
Create a complex number
Divmod (A, B)
Separate fetch and remainderNote: integral, floating-point types can be
float ([x])
Converts a string or number to a float. If no parameter is returned 0.0
int ([x[, Base]])
Converts a character to an int type, and base represents the binary
Long ([x[, Base]])
Converts a character to a long type
Pow (x, y[, z])
Returns the Y power of X
All: https://www.cnblogs.com/pyyu/p/6702896.html
ABS (x)
Absolute
Divmod (A, B)
Separate pick-up and remainder, note: integer, floating-point type can be
int ([x[, Base]])
Converts a character to an int type, and base represents the binaryInt (' 0b010010 ', base=2) means to recognize the string in binary and convert it to decimal
float ([x])
Converts a string or number to a float. If no parameter is returned 0.0
.1 s = ["A", "B", "C"]2 for me, V in Enumerate (s,1): 3 print (i,v) #>>>>>1 a 2 b 3 C(a) eval () 1. Evaluates the string str as a valid expression and returns the result of the calculation 2. Take out the contents of the string1 s = "1 + 3 +5" 2 print (eval (s)) #>>>>>>9EXEC () executes string or Complie method compiled string, no return valueFilter () filters, constructs a sequence equivalent to [item for item ' in Iterables if function (item)], sets the filter condition in the function,
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.