mirror of
https://github.com/python/cpython.git
synced 2025-09-26 18:29:57 +00:00
Bring cgi.escape docstring slightly more in line with the library ref
manual. Closes #1243553.
This commit is contained in:
parent
0d6615fd29
commit
97b2fa229c
1 changed files with 3 additions and 1 deletions
|
@ -1041,7 +1041,9 @@ environment as well. Here are some common variable names:
|
||||||
# =========
|
# =========
|
||||||
|
|
||||||
def escape(s, quote=None):
|
def escape(s, quote=None):
|
||||||
"""Replace special characters '&', '<' and '>' by SGML entities."""
|
'''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("&", "&") # Must be done first!
|
||||||
s = s.replace("<", "<")
|
s = s.replace("<", "<")
|
||||||
s = s.replace(">", ">")
|
s = s.replace(">", ">")
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue