Created
July 31, 2019 07:06
-
-
Save jvorcak/848f7e0e7bdc23963b77120f13d3f254 to your computer and use it in GitHub Desktop.
Desctructure dict in Python (source http://www.seanbehan.com/destructuring-dictionaries-in-python/)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
d = {'a':'Apple', 'b':'Banana','c':'Carrot'} | |
a,b,c = [d[k] for k in ('a', 'b','c')] | |
a == 'Apple' | |
b == 'Banana' | |
c == 'Carrot' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment