OrderedDict for older versions of python

前端 未结 7 2148
春和景丽
春和景丽 2020-11-27 17:59

Ordered dictionaries are extremely useful structures, but unfortunately these are quite recent only working in versions from 3.1 and 2.7. How can I use an ordered dictionary

7条回答
  •  广开言路
    2020-11-27 18:18

    Also you can try future, py2-3 compatible codebase:

    1. install future via pip:

    pip install future

    1. import and use OrderedDict:

    from future.moves.collections import OrderedDict

    source

提交回复
热议问题