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')
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')
转载于:https://www.cnblogs.com/xh4528/p/6538700.html