#-*-Coding:utf-8-*-Set set unordered non-repeating sequence
SE = {"A", "B", "C"} #创建SET集合
Print (Type (SE))
Li = [1,2,2,3,4] #转换一个列表成SET Collection
SE1 = Set (LI) print (SE1)
SE2 = set ()
Se2.add (123); Se2.add (567); Print (SE2)
S1={11,22,33}
S2={22,33,44}
Print (s1.difference (S2)) #取得两个集合元素 Differences
Print (S2.difference (S1))
S3=s1.symmetric_difference (S2) # Get both sides set symmetric difference element
Print (S3)
S1.difference_update (S2) #带更新的功能 updated to S1
Print (S1)
S1.symmetric_difference_update (S2) #带更新功能更新到S1
Print (S1)
S1.discard (one) #移除指定元素 without errors if not included
S1.remove (#移除), if not included will be an error
S3={22,33,44}
Print (S3.pop ()) #删除 randomly delete returned objects
Print (s1.intersection (S2)) #取两个集合交集
Print (S1.isdisjoint (S2)) #判断是否有交集
Print (S1.issuperset (S2)) #S1是否包含S2
Print (s1.union (S2)) #并集
S1.update (S2) #添加可迭代的对象
Python Basic Learning-set Collection