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 中の名前や数字による参照 (例えば
>
,>
,>
) を全て対応するユニコード文字に変換します。 この関数は、 HTML 5 標準規格で定められた有効な文字参照および無効な文字参照、list of HTML 5 named character references
を対象とします。Added in version 3.4.
html
パッケージのサブモジュールは以下のとおりです:
html.parser
-- 許容性のあるモードを持つ HTML/XHTML パーサーhtml.entities
-- HTML 実体の定義