Python provides a number of built-in functions.
First, the numerical processing correlation function:
1, take absolute value: ABS ()
def # Real signature Unknown """ "" " pass
ABS ()
2. Turn binary: Bin ()
def # "" " Return The binary representation of an integer. >>> bin (2796202) ' 0b1010101010101010101010 ' "" "
3, turn octal: Oct ()
def # "" " Return The octal representation of an integer. >>> Oct (342391) ' 0o1234567 ' "" "
4, ext. 16: Hex ()
def # "" " Return The hexadecimal representation of an integer. >>> Hex (12648430) ' 0xc0ffee ' "" "
5. Max value: Max ()
def # known special case of Max """ Max (iterable, *[, Default=obj, Key=func]), value max (arg1, arg2, *args, *[, Key=func]), value With a single iterable argument, return to its biggest item. The item that returns the maximum value using an iterative parameter is the default keyword-only argument specifies an object to return if the provided Iterable is empty. With and or more arguments, return the largest argument. """
6, take the minimum value: Min ()
def # known special case of Min """ min (iterable, *[, Default=obj, Key=func]), value min (arg1, arg2, *args, *[, Key=func]), value With a single iterable argument, return to its smallest item. The default keyword-only argument specifies an object to return if the provided iterable is empty. With and or more arguments, return the smallest argument. """
Second, the return is a Boolean value of the function:
1. All elements are true, function returns true: All ()
def # Real signature Unknown """ Return True if bool (x) is true to all values x in the iterable. If the iterable is empty, return True. """
2, one element is true, function returns true: any ()
def # Real signature Unknown """ Return True if bool (x) is true to any x in the iterable. If the iterable is empty, return False. """
3. Whether the returned object can be called: callable ()
def # real signature unknown; restored from __doc__ """ Return Whether the object is callable (i.e., some kind of function). Note that classes is callable, as is instances of classes with a __call__ () method. """
Iii. Compiling and executing code
1. Compile the string into Python code: compile ()
s="print (123)"R=compile (s,'<string>', "exec")exec(R)
2. Execute code: EXEC () and eval ()
The difference: A, exec () can execute Python code, you can execute an expression, and eval () only executes an expression
b, EXEC () just executes, no return value, and eval () has a return value
s="print (123)"R=compile (s,'<string>', "exec")exec(R)exec("print (' 10*10 ') "R=eval ("8*8")print (r)
Python Basics-built-in functions (1)