python对集合的操作

python对集合的操作

#1、创建集合
a=['fdfd','hgfh','jgf','wet']
b=set(a)

#2、集合的增加
c=b.add('hahahah')
print(c)

#3、集合的删除
c.pop()
c.remove('hahahah')
c.clear()

#4、集合的修改
c.update()

#5、集合的遍历
for i in c:
    print(i)
原文地址:https://www.cnblogs.com/hainabaichuan/p/11809527.html