I am using java.util.map to store some data ( one key and two values , per row ) in java and return it to a python function . What kind of a data structre should I use in python to catch it? (btw I am using Jython as a bridge between python and java)
java.util.map Compatible data structure in python
Collapse
X
-
Tags: None
-
You can do a dictionary of lists to emulate a map:
[code=python]
>>> md = {}
>>> md['val1'] = ['keya', 'keyb']
>>> md['val2'] = ['keyc', 'keyd']
>>> for elem in md:
... print "The key is", elem, "and the values of this key are:", md[elem]
...
The key is val2 and the values of this key are: ['keyc', 'keyd']
The key is val1 and the values of this key are: ['keya', 'keyb']
>>> [/code]
Comment