将变量连接到 Python 字符串我已经有一段时间没有真正搞过这些东西了,但 Python 提交函数有些问题。请看下面的代码
Names Default To Here( 1 );
Python Init();
Python Submit( "\[
str = 'The quick brown fox jumps over the lazy dog';
a = 200;
]\" );
getStr = Python Get( str );
getNum = Python Get( a );
Show( getStr, getNum );
Python Term();
如果我想将单词“fox”设为变量,我会认为这只是将变量连接到字符串的问题,但无论出于什么原因,我似乎无法分解该字符串?也许是因为它是一个字符串列表?我觉得这是显而易见的,但无论出于什么原因,我都错过了它。
数据访问回复:将变量连接到 Python 字符串我假设您没有使用 JMP18(但这应该没关系)。我不确定您遇到了什么问题?您正在向 Python 发送一个字符串和一个数值,然后在 JMP 中打印它们,这应该可以正常工作。
JMP18

回复:将变量连接到 Python 字符串也许是这样的?
Names Default To Here( 1 );
fox = "python";
Python Init();
Python Submit( evalinsert("\[
str = 'The quick brown ^fox^ jumps over the lazy dog';
a = 200;
]\") );
getStr = Python Get( str );
getNum = Python Get( a );
Show( getStr, getNum );
Python Term();回复:将变量连接到 Python 字符串看起来确实如此。知道为什么它使用 carrat 而不是直接用引号转义吗?
回复:将变量连接到 Python 字符串EvalInsert 是一个 JMP JSL 函数,它使用 ^ 作为插入的默认分隔符。以下是 JMP Scripting Index 条目中对该函数的描述

Fox 的替换在 JMP 中执行,然后传递给 Python
回复:将变量连接到 Python 字符串你也可以这样做:
Names Default To Here( 1 );
fox = "python";
Python Init();
Python Submit( evalinsert("
str = 'The quick brown " || fox || " jumps over the lazy dog';
a = 200;") );
getStr = Python Get( str );
getNum = Python Get( a );
Show( getStr, getNum );
Python Term();
我认为,evalinsert 提供了一种更清洁的方法。