html escape unescape

参考:
https://wiki.python.org/moin/EscapingHtml

Python 3.6.0 (default, Dec 24 2016, 00:01:50)
[GCC 4.2.1 Compatible Apple LLVM 8.0.0 (clang-800.0.42.1)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import html
>>> s = html.escape( """& < " ' >""" )
>>> print(s)
& < " &#x27; >
>>> s = html.escape( '''& < " ' >''' )
>>> print(s)
& < " &#x27; >
>>> s = html.unescape( '''& < " ' >''' )
>>> print(s)
& < " ' >

你可能感兴趣的:(安全)