py:runresult
py:runresult python-expression
Evaluates the given Python expression and reports the result. py:runresult
attempts to convert from Python data types to NetLogo data types. Numbers, strings, and booleans convert as you would expect. Any list-like object in Python (that is, anything with a length that you can iterate through) will be converted to a NetLogo list. For instance, Python lists and NumPy arrays will convert to NetLogo lists. Python dicts (and dict-like objects) will convert to a NetLogo list of key-value pairs (where each pair is represented as a list). None
will be converted to nobody
. Other objects will simply be converted to a string representation.
Note that due a current issue, dict keys will always be reported as strings. If you need to report non-string keys, report the .items()
of the dict instead of the dict itself.
Take me to the full Python Extension Dictionary