摘要: 字典是python语言中唯一的映射类型.# -*- coding: cp936 -*-# dict examples# 创建字典dict1 = {}dict2 = {'name':'earth', 'port':80}fdict = dict((['x',1],['y',2]))# 访问字典的值# 1. 遍历for key in dict2: print 'key=%s, value=%s' %(key, dict2[key])# 2. 修改dict2['name'] = ' 阅读全文
posted @ 2013-03-12 19:48 尘虑萦心 阅读(160) 评论(0) 推荐(0) 编辑