开发者

What is the escape character for % in python's string method

I am trying to pass a string which has a '%' in it (its actually a sql query strin开发者_如何学Gog). How do I pass the % (do I have to use a specific escape character?

eg: compute_answertime("%how do I%")


Use another % to escape it

>>> compute_answertime("%%how do I%%")


use %%..........


You can use:

%%; DROP TABLE Students; --

Sorry, couldn't resist.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜