转义序列解析 python 中双字符串中的值

escape sequence to parse the value inside double string in python

我有

a=2
b=4

我用过

print 'cubit.cmd("create curve vertex %d %d ") %%(a,b)' %(a,b)

这给出了

cubit.cmd("create curve vertex 2 4 ") %(a,b)

但我只想拥有没有 % 和之后的部分。喜欢

cubit.cmd("create curve vertex 2 4 ")

我想将命令解析到另一个软件,所以我必须使用转义序列的一些变体。

有什么建议吗?

问候

如果您的预期输出是:

cubit.cmd("create curve vertex 2 4 ")

...把后面的部分去掉:毕竟只是一个字符串

print 'cubit.cmd("create curve vertex %d %d ")' %(a,b)