所以,我试图让python打印一个包含tcl变量的字符串,以及该变量的结果。我在用核弹,以防对我的代码有影响。在
[set THIS image]
Ln = "/Test/still/testing/$THIS\_clean_v001"
print(Ln) # this prints exactly the above
G = nuke.tcl('[puts "$THIS"] ')
print(G)
是否返回单词image?在
然后我可以把它分进去。问题是我输入的文本字段是tcl用来在程序中很好地解决它的,但是当我把它发送到process时,它就按字面意思使用$THIS
。在
有两点需要注意:
Tcl} ,确实如此。
puts
不返回值。听起来你想要Tcl ^{位于http://www.nukepedia.com/reference/Python的
nuke.tcl
文档表明:与其将其作为完整脚本调用,不如使用未弃用的版本并通过以下方式获得所需的行为:
Whic应该重新输入
THIS
变量的值。在您还可以使用TCL
subst
命令一次性扩展字符串中的所有TCL变量。在其结果将是正确展开的字符串:
'/Test/still/testing/image_clean_v001'
subst的文档可以在这里找到:http://www.tcl.tk/man/tcl8.4/TclCmd/subst.htm
相关问题 更多 >
编程相关推荐