python有序字典
来源:互联网 发布:java实现301跳转 编辑:程序博客网 时间:2024/05/14 14:05
代码:
# -*- coding: UTF-8 -*-
import collections
print 'Regular dictionary:'
d = {}
d['a'] = 'A'
d['b'] = 'B'
d['c'] = 'C'
for k, v in d.items():
print k, v
print '\nOrderedDict:'
d = collections.OrderedDict()
d['a'] = 'A'
d['b'] = 'B'
d['c'] = 'C'
for k, v in d.items():
print k, v
执行结果:
Regular dictionary:
a A
c C
b B
OrderedDict:
a A
b B
c C
0 0
- python -- 有序字典, 有序字典的排序
- python 有序字典
- python--有序字典
- python中的有序字典
- python有序字典
- python 字典有序
- python有序字典
- python 有序字典OrderedDict
- Python有序字典
- Python 有序字典简介
- python 有序字典
- python字典保持有序
- python中的有序字典OrderedDict
- [Python]-01-创建有序字典
- python:有序字典与嵌套字典
- Python用两个list模拟有序字典
- Python案例-开发之路-有序字典
- python-4-如何让字典保持有序?
- poj 3349 数组的hash(最常用、最普通的哈希表建立)
- 对/proc和/sys的一些理解
- 读秦小波《设计模式之禅》 -- 单例模式
- LEETCODE: Binary Tree Maximum Path Sum
- 外贸营销型网站的SEO关键词技巧
- python有序字典
- 心理学集锦
- 工业产品的颜色设计
- How to kill Active SQL Connections
- python先进先出Queue
- MFC中的运行时类型识别(第二篇)
- java web 跑例子的点滴
- for(;;)的解释
- Linux命令(四)——文件查看与文件权限、属性设置