亚洲精品国产精品乱码视色,下载应用成人电影AVapp,成人影院下载视频

      <track id="gfhue"><i id="gfhue"></i></track><input id="gfhue"></input>

      1. 更多精彩內(nèi)容,歡迎關(guān)注:

        視頻號(hào)
        視頻號(hào)

        抖音
        抖音

        快手
        快手

        微博
        微博

        python內(nèi)置函數(shù)

        文檔

        python內(nèi)置函數(shù)

        python內(nèi)置函數(shù)有:abs、divmod、max、min、pow、round、sum、bool、int、float、complex、str、bytearray、bytes、memoryview、ord、oct、tuple、map等。
        推薦度:
        導(dǎo)讀python內(nèi)置函數(shù)有:abs、divmod、max、min、pow、round、sum、bool、int、float、complex、str、bytearray、bytes、memoryview、ord、oct、tuple、map等。

        python內(nèi)置函數(shù)是什么?一起來(lái)看下吧:

        python內(nèi)置函數(shù)有:

        abs:求數(shù)值的絕對(duì)值

        >>>abs(-2)
        2

        pmod:返回兩個(gè)數(shù)值的商和余數(shù)

        >>>pmod(5,2)
        (2,1)
        >>pmod(5.5,2)
        (2.0,1.5)

        bool:根據(jù)傳入的參數(shù)的邏輯值創(chuàng)建一個(gè)布爾值

        >>>bool()?#未傳入?yún)?shù)
        False
        >>>bool(0)?#數(shù)值0、空序列等值為False
        False
        >>>bool(1)
        True

        all:判斷可迭代對(duì)象的每個(gè)元素是否都為T(mén)rue值

        >>>all([1,2])?#列表中每個(gè)元素邏輯值均為T(mén)rue,返回True
        True
        >>>?all(())?#空元組
        True
        >>>?all({})?#空字典
        True

        help:返回對(duì)象的幫助信息

        >>>?help(str)?
        Help?on?class?str?in?module?builtins:
        class?str(object)
        |??str(object='')?->?str
        |??str(bytes_or_buffer[,?encoding[,?errors]])?->?str
        |??
        |??Create?a?new?string?object?from?the?given?object.?If?encoding?or
        |??errors?is?specified,?then?the?object?must?expose?a?data?buffer
        |??that?will?be?decoded?using?the?given?encoding?and?error?handler.
        |??Otherwise,?returns?the?result?of?object.__str__()?(if?defined)
        |??or?repr(object).
        |??encoding?defaults?to?sys.getdefaultencoding().
        |??errors?defaults?to?'strict'.
        |??
        |??Methods?defined?here:
        |??
        |??__add__(self,?value,?/)
        ??????????Return?self+value.

        _import_:動(dòng)態(tài)導(dǎo)入模塊

        index?=?__import__('index')
        index.sayHello()

        locals:返回當(dāng)前作用域內(nèi)的局部變量和其值組成的字典

        >>>?def?f():
        ????print('before?define?a?')
        ????print(locals())?#作用域內(nèi)無(wú)變量
        ????a?=?1
        ????print('after?define?a')
        ????print(locals())?#作用域內(nèi)有一個(gè)a變量,值為1
        >>>?f>>>?f()
        before?define?a?
        {}?
        after?define?a
        {'a':?1}

        input:讀取用戶輸入值

        >>>?s?=?input('please?input?your?name:')
        please?input?your?name:Ain
        >>>?s
        'Ain'

        open:使用指定的模式和編碼打開(kāi)文件,返回文件讀寫(xiě)對(duì)象

        #?t為文本讀寫(xiě),b為二進(jìn)制讀寫(xiě)
        >>>?a?=?open('test.txt','rt')
        >>>?a.read()
        'some?text'
        >>>?a.close()

        eval:執(zhí)行動(dòng)態(tài)表達(dá)式求值

        >>>?eval('1+2+3+4')
        10

        除了上述舉例的函數(shù)之外,內(nèi)置函數(shù)按分類還可分為:

        1、數(shù)學(xué)運(yùn)算(7個(gè))

        2、類型轉(zhuǎn)換(24個(gè))

        3、序列操作(8個(gè))

        4、對(duì)象操作(7個(gè))

        5、反射操作(8個(gè))

        6、變量操作(2個(gè))

        7、交互操作(2個(gè))

        8、文件操作(1個(gè))

        9、編譯操作(4個(gè))

        10、裝飾器(3個(gè))

        以上就是小編今天的分享,希望可以幫助到大家。

        文檔

        python內(nèi)置函數(shù)

        python內(nèi)置函數(shù)有:abs、divmod、max、min、pow、round、sum、bool、int、float、complex、str、bytearray、bytes、memoryview、ord、oct、tuple、map等。
        推薦度:
        為你推薦
        資訊專欄
        熱門(mén)視頻
        相關(guān)推薦
        python遞歸函數(shù) python類的繼承 python string函數(shù) python構(gòu)造函數(shù) python延時(shí)函數(shù) debug error怎么解決 python讀取json并解析 python 列表添加 python字典按值的大小排序 python 排序算法 spring boot mysql配置 vue動(dòng)態(tài)綁定style js date加一天 字符轉(zhuǎn)換成ascii碼 c語(yǔ)言struct用法 java reentrantlock python tkinter教程 js獲取日期 python numpy教程 opencv安裝教程python python判斷字符串相等 python查看已安裝的包 python強(qiáng)制類型轉(zhuǎn)換 python input函數(shù)怎么用 python類型轉(zhuǎn)換 python split函數(shù)用法 python讀取json python組合數(shù)據(jù)類型 python查看變量類型 python split函數(shù) c++ template用法 老抽和生抽的區(qū)別 拉鏈下滑如何解決 防藍(lán)光眼鏡怎么辨別 蔥怎么保存 老姜和生姜的區(qū)別 新鮮蘑菇怎么保存 豬腳和豬手有什么區(qū)別 亞麻籽油是什么油 白茶保存方法和時(shí)間
        Top