1

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.

1
  • Sorry, found it. master_list[1][1][1].append(dict_1) Commented Sep 29, 2011 at 8:42

1 Answer 1

3
master_list[1][1].append({key_1:value_1})
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.