VocabReminder
Easily build a great vocabulary without studying! Now on the App Store!
Click here for more info about the app

Destructuring Dictionaries in Python

       

Here is a quick and dirty way to destructure dictionaries in [Python]

d = {'a':'Apple', 'b':'Banana','c':'Carrot'}
a,b,c = [d[k] for k in ('a', 'b','c')]

a == 'Apple'
b == 'Banana'
c == 'Carrot'
Tagged w/ #python #data structures