开发者

Python nested list within a nested list without looping

I want to add a dictionary to a nested list within a nested list.

so;

['master_list 1', ['list 1', ['sub_list 1']], ['list 2'], ['list 3']]

would end up like;

['master_list_1', ['list_1', ['sub_list_1',{key_1:value_1}]], ['list_2'], ['list_3']]

I know the exact position within the lists that I want to add the dictionary, so can I add the dictionary without looping through other lists?

I have got开发者_如何转开发 as far as

master_list[0].append(list_1)

but I can't find out how to call the lower lists.


master_list[1][1].append({key_1:value_1})
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜