📜  python 从另一个字典项目中替换列表 - Python 代码示例

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

代码示例1
>>> subs = {
...         "Houston": "HOU", 
...         "L.A. Clippers": "LAC",
... 
...     }
>>> rev_subs = { v:k for k,v in subs.iteritems()}
>>> [rev_subs.get(item,item)  for item in my_lst]
['L.A. Clippers', 'Houston', '03/03 06:11 PM', '2.13', '1.80', '03/03 03:42 PM']