html --- HyperText Markup Language のサポート¶
ソースコード: Lib/html/__init__.py
このモジュールは 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 default), the characters (") and (') are also translated; this helps for inclusion in an HTML attribute value delimited by quotes, as in<a href="...">. If quote is set to false, the characters (") and (') are not translated.Added in version 3.2.
- html.unescape(s)¶
文字列 s 内の名前付き文字参照と数値文字参照 (例えば
>、>、>) を、すべて対応する Unicode 文字に変換します。 この関数は、有効な文字参照にも無効な文字参照にも HTML 5 標準で定められた規則を適用し、HTML 5 の名前付き文字参照のリストを使います。Added in version 3.4.
html パッケージのサブモジュールは以下のとおりです:
html.parser-- 許容性のあるモードを持つ HTML/XHTML パーサーhtml.entities-- HTML 実体の定義