cgi ¶
This page is about the standard library's cgi module.
The module source code for Python 2.6.5 can be found here.
escape(s[, quote])¶
The escape method.
Warning:
Although it might look like it at first, this method is NOT appropriate for HTML attribute escaping because it does not encode single quotes. This issue is being tracked here.
def escape(s, quote=None):
'''Replace special characters "&", "<" and ">" to HTML-safe sequences.
If the optional flag quote is true, the quotation mark character (")
is also translated.'''
s = s.replace("&", "&") # Must be done first!
s = s.replace("<", "<")
s = s.replace(">", ">")
if quote:
s = s.replace('"', """)
return s
Web Hosting Break iPage wordpress
-
Wiki content is available under a Creative Commons 3.0 License.
