亚洲av成人无遮挡网站在线观看,少妇性bbb搡bbb爽爽爽,亚洲av日韩精品久久久久久,兔费看少妇性l交大片免费,无码少妇一区二区三区

  免費(fèi)注冊(cè) 查看新帖 |

Chinaunix

  平臺(tái) 論壇 博客 文庫(kù)
最近訪問(wèn)板塊 發(fā)新帖
查看: 2635 | 回復(fù): 0
打印 上一主題 下一主題

Built-in Functions [復(fù)制鏈接]

論壇徽章:
0
跳轉(zhuǎn)到指定樓層
1 [收藏(0)] [報(bào)告]
發(fā)表于 2009-11-10 20:43 |只看該作者 |倒序?yàn)g覽

                                                                                                                                                                                                                                                abs(x)
Return the absolute value of a number. The argument may be a plain or long integer or a floating point number. If the argument is a complex number, its magnitude is returned.解析:返回一個(gè)數(shù)字的絕對(duì)值。
               
               
               
               
               
               
               
               
                >>> abs(1)
1
>>> abs(-1)
1
>>> abs(0)
0
>>> abs(-1.1)
1.1000000000000001
>>> abs(1.1)
1.1000000000000001
>>>
all(iterable)Return True if all elements of the iterable are true (or if the iterable is empty). Equivalent to:
解析:如果可迭代變量所有元素都為真,則返回True,否則返回False。
def all(iterable):
    for element in iterable:
        if not element:
            return False
    return True
               
               
                >>> all((1,True,3))
True
>>> all((1,False,3))
False
any(iterable)Return True if any element of the iterable is true. If the iterable is empty, return False. Equivalent to:解析:如果可迭代變量有一個(gè)元素為真,則返回True,否則返回False。
def any(iterable):
    for element in iterable:
        if element:
            return True
    return False
>>> any((1,False))
True
>>> any((False,False))
False
>>> any((False,1,False))
True
basestring()This abstract type is the superclass for
str
and
unicode
. It cannot be called or instantiated, but it can be used to test whether an object is an instance of
str
or
unicode
. isinstance(obj, basestring) is equivalent to isinstance(obj, (str,unicode)).解析:這個(gè)抽象的類型是str和unicode的超類。它不能被調(diào)用或?qū)嵗,但可以用?lái)測(cè)試對(duì)象是否為str或unicode的實(shí)例。
               
               
               
               
               
               
               
               
               
               
                >>> isinstance('chinaunix',basestring)
True
>>> isinstance('你好',basestring)
True
>>> isinstance(1,basestring)
False
bin(x)Convert an integer number to a binary string. The result is a valid Python expression. If x is not a Python
int
object, it has to define an
__index__()
method that returns an integer.
解析:將整數(shù)轉(zhuǎn)換成二進(jìn)制字符串。
               
               
                >>> bin(1)
'0b1'
>>> bin(2)
'0b10'
>>> bin(3)
'0b11'
>>> bin(4)
'0b100'
bool([x])Convert a value to a Boolean, using the standard truth testing procedure. If x is false or omitted, this returns
False
; otherwise it returns
True
.
bool
is also a class, which is a subclass of
int
. Class
bool
cannot be subclassed further. Its only instances are
False
and
True
.
               
               
               

本文來(lái)自ChinaUnix博客,如果查看原文請(qǐng)點(diǎn):http://blog.chinaunix.net/u3/105486/showart_2091111.html
您需要登錄后才可以回帖 登錄 | 注冊(cè)

本版積分規(guī)則 發(fā)表回復(fù)

  

北京盛拓優(yōu)訊信息技術(shù)有限公司. 版權(quán)所有 京ICP備16024965號(hào)-6 北京市公安局海淀分局網(wǎng)監(jiān)中心備案編號(hào):11010802020122 niuxiaotong@pcpop.com 17352615567
未成年舉報(bào)專區(qū)
中國(guó)互聯(lián)網(wǎng)協(xié)會(huì)會(huì)員  聯(lián)系我們:huangweiwei@itpub.net
感謝所有關(guān)心和支持過(guò)ChinaUnix的朋友們 轉(zhuǎn)載本站內(nèi)容請(qǐng)注明原作者名及出處

清除 Cookies - ChinaUnix - Archiver - WAP - TOP