标签:png 多个 closed 键值 key eve 分享 number 分类
2、比较运算:
3、赋值运算:
4、逻辑运算:
5、成员运算:
多个字符串,最小单位为一个字符串
int(整型)
"hello world"
name_list = [‘alex‘, ‘seven‘, ‘eric‘] 或 name_list = list([‘alex‘, ‘seven‘, ‘eric‘])
基本操作:
ages = (11, 22, 33, 44, 55) 或 ages = tuple((11, 22, 33, 44, 55))
person = {"name": "mr.wu", ‘age‘: 18} 或 person = dict({"name": "mr.wu", ‘age‘: 18})
常用操作:
li = [11,22,33,44] for item in li: print item
li = [11,22,33] for k,v in enumerate(li, 1): print(k,v)
print range(1, 10) # 结果:[1, 2, 3, 4, 5, 6, 7, 8, 9] print range(1, 10, 2) # 结果:[1, 3, 5, 7, 9] print range(30, 0, -2) # 结果:[30, 28, 26, 24, 22, 20, 18, 16, 14, 12, 10, 8, 6, 4, 2]
一、元素分类
有如下值集合 [11,22,33,44,55,66,77,88,99,90...],将所有大于 66 的值保存至字典的第一个key中,将小于 66 的值保存至第二个key的值中。
即: {‘k1‘: 大于66的所有值, ‘k2‘: 小于66的所有值}
功能要求:
goods = [ {"name": "电脑", "price": 1999}, {"name": "鼠标", "price": 10}, {"name": "游艇", "price": 20}, {"name": "美女", "price": 998}, ]
五、用户交互,显示省市县三级联动的选择
dic = { "河北": { "石家庄": ["鹿泉", "藁城", "元氏"], "邯郸": ["永年", "涉县", "磁县"], } "河南": { ... } "山西": { ... } }
标签:png 多个 closed 键值 key eve 分享 number 分类
原文地址:http://www.cnblogs.com/leiyiming/p/6914491.html