【发布时间】:2012-07-25 01:01:53
【问题描述】:
我有一个调用 c++ dll 方法的 python 方法,其中包含 printf()。
典型通话:
method ("something")
但现在我必须能够调用类似的东西
method("%x %y %z")
它正在崩溃。
我已经逃过了%,很简单
if msg:
msg = msg.replace( "%", "/%" )
它似乎适用于只有一个的情况。 (不知道具体对文字本身有什么影响……)
所以我测试了不止一个,我得到了一个 Debug Assertion Failure - Expression ("Incorrect format specifier", 0)。
编辑:接受答案后,解决方案:
if msg:
msg = msg.replace( "%", "%%" )
【问题讨论】:
标签: c++ python dll special-characters