One-liner to merge lists?

David Raymond David.Raymond at tomtom.com
Tue Feb 22 10:45:52 EST 2022


> Is there a simpler way?

>>> d = {1: ['aaa', 'bbb', 'ccc'], 2: ['fff', 'ggg']}
>>> [a for b in d.values() for a in b]
['aaa', 'bbb', 'ccc', 'fff', 'ggg']
>>>



More information about the Python-list mailing list