Reputation: 127
I need to extract the inner dictionary from outer list ie remove the outer square brackets of the list.
example:
myList =[{'a':'1','b':'2','c':'3'},{'d':'4','e':'5'}]
Desire output:
{'a':'1','b':'2','c':'3'},{'d':'4','e':'5'}
Please note that inner dictionaries can be of dynamic size.
Any help would be great.
Upvotes: 0
Views: 457
Reputation: 1432
Iterate through the list like any other list iteration:
for i in myList:
i # i is your dictionary
Upvotes: 1
Reputation: 8298
Just accessing the list element by index.
myList =[{'a':'1','b':'2','c':'3'},{'d':'4','e':'5'}]
d = myList[0]
So if you have k
dictionaries in the list you need to access all of them, but this will be tedious.
Upvotes: 3