Python中的集合(set)和字典(dict)
2013-10-10 21:15
363 查看
#适用于python3.x
Set(集合)
集合是无序的不重复的元素集,类似数学中的集合,可进行逻辑运算和算术运算。
内置函数为:'add', 'clear', 'copy', 'difference', 'difference_update', 'discard', 'intersection', 'intersection_update', 'isdisjoint', 'issubset','issuperset','pop','remove','symmetric_difference', 'symmetric_difference_update', 'union', 'update'
字典(dict)
字典是一种无序存储结构,包括关键字和对应的值。格式为: dictionary = {key:value}。关键字为不可变类型,如字符串,整数,只包含不可变对象的元组。列表不能作为关键字。
内置函数为:'clear', 'copy', 'fromkeys', 'get', 'items', 'keys', 'pop', 'popitem', 'setdefault', 'update', 'values'。
Set(集合)
集合是无序的不重复的元素集,类似数学中的集合,可进行逻辑运算和算术运算。
内置函数为:'add', 'clear', 'copy', 'difference', 'difference_update', 'discard', 'intersection', 'intersection_update', 'isdisjoint', 'issubset','issuperset','pop','remove','symmetric_difference', 'symmetric_difference_update', 'union', 'update'
字典(dict)
字典是一种无序存储结构,包括关键字和对应的值。格式为: dictionary = {key:value}。关键字为不可变类型,如字符串,整数,只包含不可变对象的元组。列表不能作为关键字。
内置函数为:'clear', 'copy', 'fromkeys', 'get', 'items', 'keys', 'pop', 'popitem', 'setdefault', 'update', 'values'。
相关文章推荐
- python入门--字典dict和集合set
- python3基础: 元组tuple、 列表list、 字典dict、集合set。 迭代器、生成器
- Python 字典dict 集合set
- 【Python】基础学习——列表(list),元祖(tuple),字典(dict),字符串(string),集合(set)
- python基础数据结构——列表(list), 元祖(tuple), 字典(dict), 字符串(string), 集合(set) 介绍及相互转换
- Python中的列表(list),元组(Tuple),字典(Dict)和集合(Set)
- python之列表(list),元组(tuple),集合(set),字典(dict)
- python 从字典里取出内容,创建集合 dict -> set
- Python学习笔记(9)-列表list、元组tuple、字典dict、集合set
- python基础学习——列表(list), 元祖(tuple), 字典(dict), 字符串(string), 集合(set) 介绍及相互转换
- python基础之字典dict和集合set
- Python3学习笔记【基础3--list,tuple,if条件判断,for/while循环,dict字典,set集合】
- python 列表list 元组tuple 字典dict 集合set 介绍
- python基础之字典dict和集合set
- 003——Python内建数据结构列表(list)、元组(tuple)、字典(dict)、集合(set)
- python中几个常见的黑盒子之“字典dict” 与 “集合set”
- python的列表(List),元组(Tuple),集合(Set),字典(Dict)
- 【Python基础】--丰富的else语句/简洁的with语句/字典dict{}/集合set{}
- 02-python学习笔记:字典dict和集合set
- Python中的列表(list),元组(Tuple),字典(Dict)和集合(Set)