Python
GetVariable
get a variable value from a Python session
SetVariable
set name=value in a Python session
Calling Sequence
Parameters
Description
Examples
Compatibility
GetVariable(n)
SetVariable(n, v)
n
-
string or name
v
expression
The SetVariable command assigns n = v in the Python environment. The value, v must be a Python object or something that can be translated into a Python data structure.
The GetVariable command fetches the variable named n from the current running Python session. A data structure conversion of the value of n will happen if possible.
This function is part of the Python package, so it can be used in the short form GetVariable(..) only after executing the command with(Python). However, it can always be accessed through the long form of the command by using Python[GetVariable](..).
with⁡Python:
SetVariable⁡a,1
true
SetVariable⁡b,2
EvalString⁡r=a+b
3
GetVariable⁡r
The Python[GetVariable] and Python[SetVariable] commands were introduced in Maple 2018.
For more information on Maple 2018 changes, see Updates in Maple 2018.
See Also
Download Help Document