On 2022-02-22 5:45 PM, David Raymond wrote:
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']
Now that's what I was looking for.I am not saying that I will use it, but as an academic exercise I felt sure that there had to be a one-liner in pure python.
I had forgotten about nested comprehensions. Thanks for the reminder. Frank -- https://mail.python.org/mailman/listinfo/python-list