KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
How can I convert a list of dicts to a dict? Below is the list of dicts: data = [{'name': 'John Doe', 'age': 37, 'sex': 'M'}, {'name': 'Lisa Simpson', 'age': 17, 'sex': 'F'}, {'name': 'Bill Clinton', 'age': 57, 'sex': 'M'}] I want to convert this to: data = {'John Doe': {'name': 'John Doe', 'age': 37, 'sex': 'M'}, 'Lisa Simpson': {'name': 'Lisa Simpson', 'age': 17, 'sex': 'F'}, 'Bill Clinton': {'name': 'Bill Clinton', 'age': 57, 'sex': 'M'}}
Tags (comma-separated)
Save Edits
Cancel