Tag: encoding does not contain SEL cat object indexer assert NIC
# Encoding:utf-8
# module __BUILTIN__
# from (built-in)
# by Generator 1.143
from __future__ Importprint_function"""built-in functions, exceptions, and other objects. Noteworthy:none is the ' nil ' object; Ellipsis represents ' ... ' in slices."""#Imports fromExceptionsImport(Arithmeticerror, Assertionerror, Attributeerror, Baseexception, Buffererror, byteswarning, DeprecationWarning, E Oferror, EnvironmentError, Exception, Floatingpointerror, futurewarning, Generatorexit, IOError, Importerror, Impo Rtwarning, Indentationerror, Indexerror, Keyerror, Keyboardinterrupt, Lookuperror, Memoryerror, NameError, NotImpl Ementederror, OSError, Overflowerror, pendingdeprecationwarning, Referenceerror, RuntimeError, RuntimeWarning, Sta Ndarderror, Stopiteration, SyntaxError, syntaxwarning, Systemerror, Systemexit, Taberror, TypeError, UnboundLocalError , Unicodedecodeerror, Unicodeencodeerror, Unicodeerror, Unicodetranslateerror, unicodewarning, UserWarning, ValueE Rror, Warning, Windowserror, Zerodivisionerror)
ABS (number) #返回值是一个数字的绝对值, in the case of complex numbers, the return value is the modulus of the plural
# back to 1.2 ABS (# return 1.2abs (# return 1.41421356237
All (iterable) #所有的值为真时才为真, as long as one is false or false
def All (iterable): for inch iterable: if not element: return False return True
>>> All (['a','b','C','D'])#list, elements are not empty or 0True>>> All (['a','b',"','D'])#List of lists, there is an empty elementFalse>>> all ([0, 1, 2, 3])#List of lists, there is an element of 0False>>> All ('a','b','C','D'))#tuples tuple, elements are not empty or 0True>>> All ('a','b',"','D'))#tuples tuple, there is an empty elementFalse>>> All ((0, 1, 2, 3))#tuples tuple, there is an element of 0False>>> all ([])#Empty listTrue>>> All (())#Empty tupleTrue
Any (iterable) #只要有一个为真就是真
def Any (iterable): for inch iterable: if element: return False return True
>>> any (['a','b','C','D'])#list, elements are not empty or 0True>>> any (['a','b',"','D'])#List of lists, there is an empty elementTrue>>> any ([0,"', False])#list, elements are all 0, ', FalseFalse>>> any ('a','b','C','D'))#tuples tuple, elements are not empty or 0True>>> any ('a','b',"','D'))#tuples tuple, there is an empty elementTrue>>> any (0,"', False))#tuples tuple, element all 0, ', FalseFalse>>> any ([])#Empty listFalse>>> any (())#Empty tupleFalse
Apply (P_object, Args=none, Kwargs=none)
# used to call a function indirectly when a function parameter already exists in a tuple or dictionary. Args is a tuple that contains the arguments passed by position that will be supplied to the function. If args is omitted, no arguments are passed, and Kwargs is a dictionary containing the keyword arguments.
# The return value of apply () is the return value of func (), the element parameter of apply () is ordered, and the order of the elements must match the order of the Func () Form parameters
#with no parametersdefsay ():Print 'say in'apply (say)#parameters with tuple onlydefSay (A, b):PrintA, bapply (say, ("Hello","Zhang San python") # function (object, *args)#with keyword parameterdefSay (a=1,b=2): PrintA, bdefHaha (* *kw): Apply (say, (), kw) # function (object, (), **keywords)PrintHaha (a='a', b='b')
Bin (number) #将整数x转换为二进制字符串, if X is not of type int in Python, x must contain method __index__ () and the return value is integer
# integer, with 0b more in front, which means binary. bin (521 " 0b1000001001 " # The case of a non-integral type, you must include the __index__ () method to cut the type of the return value to integer class Type: def __index__ return 8testbin = Type () print bin (testbin) " 0b1000 "
Callable (P_object) #检查对象object是否可调用. If return true,object still may fail, but if return false, calling object Ojbect will never succeed.
>>>classA:defAdd (A, b):returnA +b>>>callable (A) True>>> A =A ()>>>callable (a) False>>>classB:def __call__(self):return0>>>callable (B) True>>> B =B ()>>> Callable (b)#The class is callable, and an instance of the class implements the __call__ () method to invoke theTrue
Chr (i) # returns the ASCII character corresponding to the integer I, the positive number between the I range [0, 255]
>>> chr '\x1b'>>> chr'a '>>> chr (98)'b'
Python __builtin__ Module Introduction