Python - Maple Programming Help

Online Help

All Products    Maple    MapleSim


Home : Support : Online Help : Connectivity : Python : Python/GetVariable

Python

  

GetVariable

  

get a variable value from a Python session

  

SetVariable

  

set name=value in a Python session

 

Calling Sequence

Parameters

Description

Examples

Compatibility

Calling Sequence

GetVariable(n)

SetVariable(n, v)

Parameters

n

-

string or name

v

-

expression

Description

• 

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](..).

Examples

withPython:

SetVariablea,1

true

(1)

SetVariableb,2

true

(2)

EvalStringr=a+b

3

(3)

GetVariabler

3

(4)

Compatibility

• 

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

Python