python----內建函數

來源:互聯網
上載者:User

標籤:運算   檔案   glob   asc   傳回值   mod   local   pre   數學   

內建函數:python提供的內建函數一共有68個。

一、範圍相關

      (1)---------locals():查看局部                               (2)-------globals()---查看所有的全域變數

例如:

def func():    x=1    y=2print(locals())  #列印局部範圍的名字print(globals())   #列印全域範圍名字

二、str類型代碼執行
    (1)exec------沒有傳回值             (2)eval-------有傳回值                        (3)compile--------編譯

三、其他

    (1)輸入-----------input                輸出-------------print

     (2)資料類型相關--type--------查看資料的類型

     (3)記憶體相關         hash---通過計算擷取記憶體位址           id----------單純的擷取記憶體位址

     (4)檔案操作相關      open--------開啟檔案

     (5)模組相關        ---import----調用模組的方法

     (6)協助         help

      (7)調用相關      callable------返回True或False

      (8)查看內建屬性      dir

四、基礎資料類型相關

       (1)和數字相關

          資料類型      int      folat       bool       complex

          進位轉換      bin :二進位             oct:八進位              hex:十六進位

          數學運算      max:最大值          min:最小值            sum:和          abs            divmod           round            pow     

       (2)和資料結構相關

           序列    

                列表和元組          list               tuple

                相關內建函數      reversed---------順序翻轉             slice

                字串       str       format          bytes        bytearray      memoryvew         ord       chr        ascii        repr     

          資料集合

                字典      dict

                集合       set      frozenset

          相關內建函數        len      enumerate       all        any        zip         filter       map           sorted

 

python----內建函數

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.