html — HyperText Markup Language support - Python 3.11.1 documentation 编辑
Source code: Lib/html/__init__.py
This module defines utilities to manipulate HTML.
- html.escape(s, quote=True)
Convert the characters
&
,<
and>
in string s to HTML-safe sequences. Use this if you need to display text that might contain such characters in HTML. If the optional flag quote is true, the characters ("
) and ('
) are also translated; this helps for inclusion in an HTML attribute value delimited by quotes, as in<a href="...">
.New in version 3.2.
- html.unescape(s)
Convert all named and numeric character references (e.g.
>
,>
,>
) in the string s to the corresponding Unicode characters. This function uses the rules defined by the HTML 5 standard for both valid and invalid character references, and thelist of HTML 5 named character references
.New in version 3.4.
Submodules in the html
package are:
html.parser
– HTML/XHTML parser with lenient parsing modehtml.entities
– HTML entity definitions
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论