Hi I would like to convert a list of dictionaries into a single dictionary of some of the items in the list: I have:
>>> print(dct_lst)
[{'id': 456, 'name': 'bar'}, {'id': 789, 'name': 'baz'}, {'id': 123, 'name': 'foo'}]
I want:
dct={'bar':None
'baz':None
'foof':None}
and I've tried (among other combinations):
>>> for i in dct_lst['name']:
... btns[i]=None
...
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
TypeError: list indices must be integers, not str
How do I get what I need?