Python standard library: built-in functions abs (x), pythonabs
Returns the absolute value of a number. The parameter can be an integer or floating point number. If the parameter is a plural value, the modulo of the plural value is returned. Therefore, the note of abs () function is that the complex numbers are calculated differently.
Example:
# Positive integer print ('abs (1): ', abs (1) # negative integer print ('abs (-1):', abs (-1 )) # print ('abs (-10.5): ', abs (-10.5) # print ('abs (3 + 4j ):', abs (3 + 4j ))
The output result is as follows:
Abs (1): 1
Abs (-1): 1
Abs (-1, 10.5): 10.5
Abs (3 + 4j): 5.0
In this example, 1,-1 is an integer,-10.5 is a floating point, and 3 + 4j is a plural number.
Cai junsheng QQ: 9073204 Shenzhen
How to view built-in functions in python
Import sys
Print dir (sys. modules ['_ builtin _'])
Who will give an example of several python built-in functions?
All built-in functions of python
Abs () divmod () input () open () staticmethod ()
All () enumerate () int () ord () str ()
Any () eval () isinstance () pow () sum ()
Basestring () execfile () issubclass () print () super ()
Bin () file () iter () property () tuple ()
Bool () filter () len () range () type ()
Bytearray () float () list () raw_input () unichr ()
Callable () format () locals () reduce () unicode ()
Chr () frozenset () long () reload () vars ()
Classmethod () getattr () map () repr () xrange ()
Cmp () globals () max () reversed () zip ()
Compile () hasattr () memoryview () round () _ import __()
Complex () hash () min () set () apply ()
Delattr () help () next () setattr () buffer ()
Dict () hex () object () slice () coerce ()
Dir () id () oct () sorted () intern ()
I have read it all over again. What kind of usage do you want to know?