ordereddict有序字典

import collections as con

# 有序添加和取字典元素
ord = con.OrderedDict()
ord['a'] = 1
ord['b'] = 2
ord['c'] = 3
print(ord, 'ordereddict')

# 移动某元素到最后
ord.move_to_end('a')
print(ord, 'move_to_end')

  

posted @ 2017-03-12 18:18  破斧呈粥  阅读(149)  评论(0编辑  收藏  举报