I have a list which contains 2 dictionaries as follows:
accuracy=[{'value':1,'key':'apple'},
{'value':2,'key':'orange'}]
I have a code like the below:
for fruit in accuracy:
print fruit
The above code will give the following result:
{'value':1,'key':'apple'}
{'value':2,'key':'orange'}
But i want something like this:
If i give name=fruit.key the output should be name=apple and same in the case for orange also and If i give name=fruit.value the output should be value=1 and similar case for other fruit too. how can I achieve this.I know the above code i.e; name=fruit.key wont produce my desired result.So is there anyway to get it?please help
dict's aren't just{'apple': 1}and{'orange': 2}?