20.1. html --- HyperText Markup Language のサポート¶
ソースコード: Lib/html/__init__.py
このモジュールは HTML を操作するユーティリティを定義しています。
- 
html.escape(s, quote=True)¶
- 文字列 s 内の - &、- <、および- >を HTML セーフなシーケンスに変換します。これらの文字を含む HTML を表示する必要がある場合に使用します。オプションフラグ quote が真の場合、文字 (- ") および (- ') も変換します。これは例えば- <a href="...">など、引用符で括られている HTML 属性値を包含する時に役立ちます。- バージョン 3.2 で追加. 
- 
html.unescape(s)¶
- Convert all named and numeric character references (e.g. - >,- >,- &x3e;) 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 the- list of HTML 5 named character references.- バージョン 3.4 で追加. 
html パッケージのサブモジュールは以下のとおりです:
- html.parser-- 許容性のあるモードを持つ HTML/XHTML パーサー
- html.entities-- HTML 実体の定義
