python 基础学习二 dict list set
dict 相当于 java的 map {} ,list 数组 [] ,set set()
#!/usr/bin/python
xuehao ={"zhangsan":"1","lisi":"2","wangwu":"3"}
print xuehao
print xuehao["zhangsan"]
color=["red","blank","yellow"]
print color
print color[0]
a_set = set()
a_set.add("aaa")
a_set.add("bbb")
a_set.add("ccc")
print a_set
[root@master src]# python 3.py
{'lisi': '2', 'zhangsan': '1', 'wangwu': '3'}
1
['red', 'blank', 'yellow']
red
set(['aaa', 'bbb', 'ccc'])