1.dict
2.list
删除元素:
remove,pop,del
3.set
set是一个无序的,不重复的元素集合
set中每个元素都是可哈希的,但是set不是可哈希的。相对应的frozenset,可hash,可以作为keys存在于dict中
支持 x in set, len(set), for x in set,不支持slice等序列操作
集合对象还支持union(联合),intersection(交),difference(差),sysmmetric_difference(对称差集)等数学运算.
元素操作:add, remove,pop,clear,discard,update等
set和list结合,可以用来判断list中元素是否重复
def checkuq(listdata):
setdata=set(listdata)
if len(listdata)>len(setdata):
return False
else:
return True
if __name__=="__main__":
dd=['a','b','c','d','a','e']
if checkuq(dd):
print "true"http://write.blog.csdn.net/postedit/17487271
else:
print "false"
print dd
4.str
http://codingnow.cn/language/353.html