如何将两个列表的字典拆分为两个不同的列表?
字典的结构如下:
{'key1': ['PTRG0097',
'CPOG0893',
'MMUG0444',
'BTAG0783'],
'key2': ['CPOG0893',
'MMUG0444',
'PPYG0539',
'BTAG0083']}
最佳答案
我们就是这样展开的:
>>> d = {'key1': ['PTRG0097', 'CPOG0893', 'MMUG0444', 'BTAG0783'], 'key2': ['CPOG0893', 'MMUG0444', 'PPYG0539', 'BTAG0083']}
>>> l1, l2 = d.values() # or this: d['key1'], d['key2']
>>> l1
['PTRG0097', 'CPOG0893', 'MMUG0444', 'BTAG0783']
>>> l2
['CPOG0893', 'MMUG0444', 'PPYG0539', 'BTAG0083']