📜  python ordereddict - Python 代码示例

📅  最后修改于: 2022-03-11 14:45:56.256000             🧑  作者: Mango

代码示例5
#Update: As of Python 3.7 (and CPython 3.6), standard dict is 
    #guaranteed to preserve order and is more performant than OrderedDict. 
#(For backward compatibility and especially readability, 
    #however, you may wish to continue using OrderedDict.)

>>> keywords = ['foo', 'bar', 'bar', 'foo', 'baz', 'foo']

>>> list(dict.fromkeys(keywords))
['foo', 'bar', 'baz']