开发者

Google App Engine - function which clean string from html tags

开发者 https://www.devze.com 2023-02-01 05:53 出处:网络
I have a question if there is any function which can clean a string from html tags in google app engine api?

I have a question if there is any function which can clean a string from html tags in google app engine api?

For example I have textarea - comments and somebody wrote:

 <b> Bla bla bla </b>

I want to clean it. Is there any function to do it? or I should write my own?

I know there is cgi.escape() and the tags are ignored but they are stil开发者_JAVA技巧l in this string Thanks


I do it this way

defaultfilters.striptags(text)


You almost certainly want to rely on your templating engine to do this. Most or all templating systems include this functionality - in Django, you use the |escape filter - and escaping on output is far more flexible than doing it on input.

0

精彩评论

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