Python基础学习-4
散列类型 运算符优先级和逻辑运算
1 集合 唯一性;无序性,没有索引 可变
两种定义: set() {}
四种运算 & | - ^
增 add() update() 删除 pop() remove() 查看 issubset() issuperset() isdisjoint()
2 字典 可变;key具有唯一性 key无序
定义 {'a':1, 'b':2} 键值对形式 dict(a = 1, b = 2)
增 copy() setdefault()有则查,无则加 删 clear() pop() popitem()随机删除 改 update() 查看 get() keys() values() items()
3 运算
逻辑运算 type() isinstance()
比较运算 == !=
多个条件 and or not