I donβt understand why you use dict( ) when you can just use { } ..
Do you know the functions of the dictionary? If not, I recommend you try the dir() function.
There are some functions you can use:
. keys() , returns a list of all the keys in the dictionary.
. values() , returns a list of all the values ββin the dictionary.
. items() returns a list that in each cell contains 2 'variables', [0] = key, [1] = value
Example:
d = { "First":1, "Second":2 } d.keys() >> [ "First", "Second" ] d.values() >> [ 1, 2 ] d.items() >> [ ("First", 1), ("Second", 2) ]
source share