【问题标题】:PopItem in dictionary returns Last inserted pair for 3.7 onwards. How is it as dictionary is unordered [duplicate]从 3.7 开始,字典中的 PopItem 返回最后插入的对。字典是无序的[重复]
【发布时间】:2019-07-05 15:09:07
【问题描述】:

popitem() 在字典中保证返回最后插入的对 3.7 及更高版本。字典是无序类型。那么,字典是如何做到这一点的呢?

【问题讨论】:

    标签: python python-3.x dictionary


    【解决方案1】:

    从 3.6(实现细节)开始,它不再是无序的,并且从 3.7 开始保证。所以自然而然地,基于顺序的方法现在有了可预测的结果。

    Are dictionaries ordered in Python 3.6+?

    【讨论】:

      猜你喜欢
      • 2019-07-17
      • 1970-01-01
      • 2022-08-17
      • 2018-01-02
      • 2019-03-23
      • 1970-01-01
      • 2018-11-02
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多