標籤:運算 檔案 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----內建函數