2017年10月14日

摘要: 字典循环的效率问题: 1 info={ 2 'stu1001':'tenglan wu', 3 'stu1002':'longze luola', 4 'stu1003':'xiaozee mali', 5 } 6 7 for i in info:#循环打印字典的key 8 print(i) 9 f 阅读全文
posted @ 2017-10-14 16:44 Alan_chow 阅读(108) 评论(0) 推荐(0) 编辑
摘要: fromkeys1、将列表创建为字典 2、创建的字典value等于将值拷贝了三次,实际value指向的是一个地址 a=info.fromkeys([1,2,3])#将列表创建为字典 print(a) b=dict.fromkeys([4,5,6],[1,{'name':'Alan'},678])#等于将值拷贝了三次,实际value指向的是一个地址 print(b) b[4][1]['n... 阅读全文
posted @ 2017-10-14 16:33 Alan_chow 阅读(200) 评论(0) 推荐(0) 编辑
摘要: update方法:对于字典a,通过b来更新:如果a字典中存在b字典中的key-value值,则对a进行更新,不存在的值则插入 阅读全文
posted @ 2017-10-14 16:12 Alan_chow 阅读(1102) 评论(0) 推荐(0) 编辑
摘要: #字典的操作#key-value类型的数据类型 info={ 'stu1001':'tenglan wu', 'stu1002':'longze luola', 'stu1003':'xiaozee mali', } p=info.get('stu1001')#安全获取 print(p) print('stu1003'in info)#判断key是否在字典内 print(... 阅读全文
posted @ 2017-10-14 15:47 Alan_chow 阅读(313) 评论(0) 推荐(0) 编辑
摘要: python字符串操作的基本方法: 阅读全文
posted @ 2017-10-14 15:20 Alan_chow 阅读(141) 评论(0) 推荐(0) 编辑

2017年10月10日

摘要: 几句话说的挺有意思的: 1、大多数人往往都高估了了自己的能力。 2、The life we wanted. 3、有些时候,只有感受过后才知道需要它。 4、All growth is a leap in the dark. 阅读全文
posted @ 2017-10-10 19:35 Alan_chow 阅读(107) 评论(0) 推荐(0) 编辑
摘要: 1 goods_list=[ 2 ('huaweiP9',3200), 3 ('Macbook',6180), 4 ('furongwang',225), 5 ('chengguangCup',85), 6 ('pythonbook',84) 7 ] 8 shopping_list=[] 9 sal 阅读全文
posted @ 2017-10-10 19:24 Alan_chow 阅读(149) 评论(0) 推荐(0) 编辑

导航