Python的数据类型
不可变数据(3 个):Number(数字)、String(字符串)、Tuple(元组);
可变数据(3 个):List(列表)、Dictionary(字典)、Set(集合)。
Python的数据结构
- 不可变数据(3 个):Tuple(元组);
- 可变数据(3 个):List(列表)、Dictionary(字典)、Set(集合)。
序列的通用操作
- 序列:字符串,元组,列表
1.索引&切片(字典,集合不是序列)
2.序列相加
3.序列重复
4.成员资格
5.len(),min(), max(),sum().
列表
1.删除:del、pop()、remove()、clear()。
2.修改:
3.增加:append()、extend()、insert()。
4.查找:index()
6.其他操作:reverse()、count()、sort()。
元组
1.删除:del
2.查找:index()、
3.其他操作:count()、内置函数reversed()和sorted()、
字符串
1.删除:
2.修改:replace()、split()、lower()、upper()、strip()、
2.查找:find()、index()、
2.其他操作:f"{}"、r’‘/R’‘、’{}'.format()、startwith()、endwith()、isalpha()
、isdigit() 、isalnum()、‘’.join(iterable)
字典
1.del、clear()、
2. get(key[,default])
3. items() ,keys(),values(),
4. dict.setdefault(key, [default])
5. dict.update()
6. 6.dict.popitem()
7. 7.dict.pop(key,[default])
集合
没有索引和切片
add()、update()、pop()、remove() 、clear()、