python Programming Glossary: cgi.escape
What's the easiest way to escape HTML in Python? http://stackoverflow.com/questions/1061697/whats-the-easiest-way-to-escape-html-in-python the easiest way to escape HTML in Python cgi.escape seems like one possible choice. Does it work well Is there something.. better python html share improve this question cgi.escape is fine. It escapes to lt to gt to amp That is enough for all.. document header utf 8 for maximum compatibility . Example cgi.escape u' a bá a ' .encode 'ascii' 'xmlcharrefreplace' ' lt a gt b..
What does the 'u' symbol mean in front of string values? http://stackoverflow.com/questions/11279331/what-does-the-u-symbol-mean-in-front-of-string-values dictionarymain def escape_html s return cgi.escape s quote True app webapp2.WSGIApplication ' ' MainHandler debug..
HTML Entity Codes to Text http://stackoverflow.com/questions/663058/html-entity-codes-to-text with HTML entity codes e.g. lt amp to a normal string e.g. cgi.escape will escape strings poorly but there is no unescape . python..
|