您完全不能依赖键顺序:
>>> {1: None, 9: None}{1: None, 9: None}>>> {9: None, 1: None}{9: None, 1: None}>>> {1: None, 2: None}{1: None, 2: None}>>> {2: None, 1: None}{1: None, 2: None}
字典是无序的。在Python 2.7中有
collections.OrderedDict。
欢迎分享,转载请注明来源:内存溢出
您完全不能依赖键顺序:
>>> {1: None, 9: None}{1: None, 9: None}>>> {9: None, 1: None}{9: None, 1: None}>>> {1: None, 2: None}{1: None, 2: None}>>> {2: None, 1: None}{1: None, 2: None}
字典是无序的。在Python 2.7中有
collections.OrderedDict。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)