Appending values to all keys of python dictionary

Viewed 3068

I have the following dictionary:

dic={'a': {'aa': [], 'ab': [], 'ac': []}, 'b': {'ba': [], 'bb': [], 'bc': []}}

I want to append three values to either all keys in 'a' or 'b'. Following example works:

dic['a']['aa'].append(value_a)
dic['a']['ab'].append(value_b)
dic['a']['ac'].append(value_c)

Any way where I can do this in one single line. What I'm searching for is something like the following:

dic['a'][*] = [value_a, value_b, value_c]

Where * is a wildcard indexing all keys in dic['a'].

As the complexity of the dictionary in my actual program grows my current working example becomes unreadable. So my motivation for this is mainly readability.

2 Answers
Related