Lamba
Add:
Example:
The reduce usage in the previous example:
Built-in functions
, there are 137 of functions, classes, etc.
The first letter of the class is capitalized
To view the methods of a function or class:
Common built-in functions:
1. Return the absolute value of a number
To view the built-in function methods:
So:
2. Maximum minimum value of the list
To take a size value built-in function method:
To compare multiple parameters:
Compare Number Size:
Common built-in functions
Len () function
strings, tuples, lists, dictionaries are all possible. A bit for the dictionary example:
Divmod () built-in functions:
As can be seen from the description, the function is to return two numbers of quotient and remainder.
POW () built-in function:
When the two parameters, equal to the y of X, when three parameters, equal to the X y-side and Z to take the remainder
Example:
Round () built-in functions:
Example:
Callable () built-in functions:
To determine whether this object is callable or not.
Example:
Type () built-in functions:
Isinstance () built-in functions:
Returns a Boolean value
Example:
Previously defined functions for L and S:
and type do not need to be located only:
When judging a class, use isinstance to better judge it.
CMP () built-in functions:
Compare strings:
Comparisons are by character, not by length.
Range () and xrange () have seen these two before.
Type conversions, built-in functions:
Int ()
Example:
Long ()
Float ()
Complex ()
Transformed into a plural
STR ()
List ()
Type ()
Hex ()
Returns a 16 binary string
Eval ()
Restore 16 binary to 10 binary
Oct () converts 10 binary to 8 binary
Do your own research.
Chr () built-in function
The character that is returned is the corresponding ASCII code.
Ord () built-in functions
About the built-in functions for string processing (that is, methods):
Str.capitalize ()
View methods
Method Description:
Returns a string in which the first letter of the string is capitalized.
Example:
Str.replace ()
Description: Replace string
Str.split ()
Cut a string into a list
Str.join ()
String module
Import Sting Module
Many ways
Print all lowercase letters
Print all uppercase letters
Capitalize the first letter of the string
Replace string
Sequence processing functions:
Filter ()
Define function Name:
After the function is processed:
Zip ()
When the length of the third list differs from the first two, the shortest one is taken.
Map ()
Two lists used:
Reduce ()
Fileter + anonymous function
Map + anonymous functions
Reduce + anonymous functions
List expressions (list overrides)
Example:
Review Python anonymous function built-in functions