<< pyenv | Python engine | pyrunfile >> |
pyrun(code) |
outvars = pyrun(code, outputs) |
outvars = pyrun(code, outputs, pyName, pyValue) |
a string scalar, string array, character vector, character array or python code object.
Input arguments name and value
string array: Python variable names.
One or more Nelson workspace variable names returned as valid Python types.
pyrun(code) function executes Python statements present in the code string within the Python interpreter.
Variables generated by the pyrun function remain persistent, allowing their usage in subsequent pyrun calls.
outvars = pyrun(code, outputs) Python variables specified in outputs are returned to Nelson.
The values of these variables are captured in outvars.
outvars = pyrun(code, outputs, pyName, pyValue), the code is executed with assigned input and output variable names using Nelson data passed through one or more name-value arguments.
pyrun('a = b * c', 'b', 5, 'c', 10)
r = pyrun('d = a + c', 'd')
pyrun(["a = 3","print(a)"])
[R1, R2] = pyrun("a=b*c",["a","b"], 'b', 5, 'c', 10)
Python code object representing a script generated through the built-in compile function in Python
PYCODE = pyrun('X = compile(''Y = 3'', ''test'', ''exec'')', 'X')
y = pyrun(PYCODE, 'Y')
pyrunfile, pyenv, Python types supported.
Version | Description |
---|---|
1.3.0 | initial version |
1.4.0 | Python code object allowed as first input argument |
Allan CORNET