python資料型別簡單分類

2021-10-07 11:29:04 字數 414 閱讀 5865

常見的資料型別:

str、int、float、dict、tuple、set、complex、bool

python的可變資料型別:

list(列表)、dict(字典)、set(集合)

當該資料型別的對應變數的值發生了改變,那麼它對應的記憶體位址不發生改變,對於這種資料型別,就稱可變資料型別。

python的不可變資料型別:

int(整數型)、str(字串)、tuple(元組)、float(浮點型)

當該資料型別的對應變數的值發生了改變,那麼它對應的記憶體位址也會發生改變,對於這種資料型別,就稱不可變資料型別。

容器型資料型別:list(列表)、dict(字典)、set(集合)、tuple(元組)

資料型別分類

資料型別 兩大類 資料型別的判斷 typeof 資料 或者 typeof 資料 typeof null 時返回的時object console.log typeof 數字 返回數字 number console.log typeof 字串 返回字串 string console.log typeof...

Python 簡單資料型別

數字 整數 int,long 整數在3版本沒有大小長度分別,記憶體決定整數最大長度 浮點數 float 無窮小數會做精度處理,四捨五入,只要有小數點就是浮點型 布林 bool 非空 none 非0為真,0或空為假 複數 complex 複數的標誌為虛部以大寫 j 或小寫 j 結尾 字串 表達方式 單...

python資料型別簡單整理

現在只是一部分資料型別的簡單整理,後續還會更新 這裡來乙個示例,後續介紹的就不給出示例了,不然篇幅太長影響閱讀 s 1,3,5,7,5,9,3,7,9 x in s 3 in s true 2 in s false x not in s 3 not in s false 2 not in s tru...