# -*- coding: utf-8 -*-
#__author__:Selid
#__date__:2018/12/21
# 集合的增删查
# 增
set={'selid','yinnan','yixing','jingtian'}
# set.add('ddd')
# set.update('selid')
# 删
# set.pop() #随即删除,有返回值
# set.clear()
# set.remove('selid')
# del set
# 查
# for i in set:
# print i
#
# print set
# set1={1,2,3,4,5}
# set2={4,5,6,7,8,9}
# 并集
# print set1 | set2
# print set1.union(set2)
# 交集
# print set1 & set2
# print set1.intersection(set2)
#
# 差集
# print set1-set2
# print set1.difference(set2)
#反交集
# print set1 ^ set2
# print set1.symmetric_difference(set2)
# 子集与超集 返回值都是True or False
set1={4,5}
set2={4,5,6,7,8,9}
# print set1 < set2
# print set1.issubset(set2)
#
# print set2>set1
# print set2.issuperset(set1)
#不可变集合
s=frozenset('selid')
print s, type(s) # frozenset(['i', 's', 'e', 'l', 'd']) <type 'frozenset'>