I’m wanting to create a Mapping like so:
assets = {'first': ['type1','type2','type3'], 'second': ['type1','type2']}
Just a simple Mapping (associative array). I’m not sure if the syntax above is correct (new to python), but that is the idea I’m going for.
Now, I want to be able to loop through the mapping:
for key, value in assets:
But that returns an error:
ValueError: too many values to unpack
How can I go about doing this?
Try:
The default iterator for a
dictis just the key values. The use ofitems()produces a sequence of (key, value) tuples.