I have list of dictionaries each key mapped to list
[ {28723408: [28723409]},
{28723409: [28723410]},
{28723410: [28723411, 28723422]},
{28723411: [28723412]},
{28723412: [28723413]},
{28723413: [28723414, 28, 28723419]}]
I want to create list of tuples key mapped to each list value:
[(28723408, 28723409),
(28723409, 28723410),
(28723410, 28723411),
(28723410, 28723422),
(28723411, 28723412),
(28723412, 28723413),
(28723413, 28723414),
(28723413, 28),
(28723413, 28723419),]
I did it following way:
for pairs in self.my_pairs:
for source, targets in pairs.items():
for target in targets:
pair_list.append((source, target))
Is there more Pythonic way doing so ?