开发者

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

开发者 https://www.devze.com 2023-01-16 10:53 出处:网络
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?

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

精彩评论

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