邏輯表達(dá)式: bool
not a : 非
a and b : a &b
a or b : a || b
a is b : a 和 b 是同一個(gè)對(duì)象
a is not b : a 和 b 不是同一個(gè)對(duì)象
列表 :' [] '
- cmp(list1,list2) 比較倆個(gè)列表的元素
- len(list) 列表元素個(gè)數(shù)
- max(list) 返回列表元素最大值
- min(list) 返回列表元素最小值
- list(seq) 將元組轉(zhuǎn)化為列表
方法:
- list.append(obj) 再列表末尾添加一個(gè)元素
- list.count(obj) 統(tǒng)計(jì)某個(gè)元素在列表中出現(xiàn)的次數(shù)
- list.extend(obj) 在列表的末尾追加另一個(gè)序列多個(gè)值
- list.index(obj) 檢索列表中第一個(gè)匹配項(xiàng)位置
- list.insert(index, obj) 將一個(gè)元素插入列表的某個(gè)位置
- list.pop(index) 移除列表中的一個(gè)元素
- list.remove(obj) 移除列表中第一個(gè)匹配項(xiàng)
- list.reverse() 反向列表元素
- list.sort([func]) 對(duì)原列表進(jìn)行排序
元組 :'()'
字典 :'{key:value}'