python built-in functions

abs returns the absolute value of the parameter

>>> abs(-3)
3

all is true for each element of the iterable

>>> all ( ' nidaye ' )
True
>>> all([1,0])
False

whether any iterable has true elements

>>> any ( ' nidaye ' )
True
>>> any([1,0])
True

ascii returns a string representing the object

>>> ascii([1,0])
'[1, 0]'

bin returns binary notation

>>> bin(2)
'0b10'
>>> bin(4)
'0b100'

 

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=324937486&siteId=291194637