Is there a structure in Python similar to C++ STL map?

前端 未结 6 1152
没有蜡笔的小新
没有蜡笔的小新 2021-02-05 05:02

Is there a structure in Python which supports similar operations to C++ STL map and complexity of operations correspond to C++ STL map?

6条回答
  •  -上瘾入骨i
    2021-02-05 05:58

    Python SortedDict is a similar to C++ STL map. You can read about it here or here.

    SortedDict is a container of key-value pairs in which an order is imposed on the keys according to their ordered relation to each other. As with Python’s built-in dict data type, SortedDict supports fast insertion, deletion, and lookup by key.

提交回复
热议问题