KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
What is the best way to split a dictionary in half? d = {'key1': 1, 'key2': 2, 'key3': 3, 'key4': 4, 'key5': 5} I'm looking to do this: d1 = {'key1': 1, 'key2': 2, 'key3': 3} d2 = {'key4': 4, 'key5': 5} It does not matter which keys/values go into each dictionary. I am simply looking for the simplest way to divide a dictionary into two.
Tags (comma-separated)
Save Edits
Cancel