📜  python代码示例中的排序集

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

代码示例1
#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']