基本資料型別
可變引數否
list
可變number
不可變string
不可變tuple
不可變dictionary
可變number的型別:(範圍從小到大)
int > long >float >complex
序列:名稱
list
tuple
dictionary
新增tuple不可新增
dictionary[key] = 「a」
刪除del list[index]
tuple不可刪除
del dictionary[key]
修改list[index] = 「b」
tuple不可修改
dictionary[key] = 「b」
取值list[index]
tuple[index]
dictionary[key] / dictionary.get(key)
python基本資料型別
物件是python中最基本的概念,python中資料以物件的形式出現 無論是python提供的內建物件,還是使用python或是像c擴充套件庫這樣的擴充套件語言工具建立的物件。物件時記憶體中的一部分,包括數值和相關操作的集合。python程式可以分解成模組 語句 表示式以及物件,如下 1 程式由模組...
Python基本資料型別
1 python中一切都是物件。2 每乙個資料都有乙個id標示,用id 可以檢視。也可以用type檢視是什麼型別。3 常用的資料型別 int 整型 數字 boole true 值 賦值,要用大寫 a true string 字串 也稱作序列。list 列表 tuple 元組 dict 字典 set ...
Python基本資料型別
python內建許多資料基本型別。資料型別dt 表示形式 int整形如 1,0,1,float 浮點型如 1.1,0.0,1.1,str字串如 單引號或雙引號括起來的形式 hello python list 列表如 1,2 巢狀列表 1,2,3 tuple 元組如 1,2 set無序列表如 comp...