I have a dict:
D = {'KEY-2': ['KEY-3.1', 'KEY-3.2']}
I want to change it:
D['KEY-2'] = dict.fromkeys(D.pop('KEY-2'),[])
>>> D
{'KEY-2': {'KEY-3.1': [], 'KEY-3.2': []}}
And append line to one of key subdict
D['KEY-2']['KEY-3.1'].append('line')
And I get:
>>> D
{'KEY-2': {'KEY-3.1': ['line'], 'KEY-3.2': ['line']}}
Why? What can I add line to only list D['KEY-2']['KEY-3.2']
?