html.entities --- HTML 一般實(shí)體的定義?

源碼: Lib/html/entities.py


該模塊定義了四個(gè)詞典, html5name2codepoint、 codepoint2name、以及 entitydefs

html.entities.html5?

將 HTML5 命名字符引用 1 映射到等效的 Unicode 字符的字典,例如 html5['gt;'] == '>'。 請注意,尾隨的分號(hào)包含在名稱中(例如 'gt;' ),但是即使沒有分號(hào),一些名稱也會(huì)被標(biāo)準(zhǔn)接受,在這種情況下,名稱出現(xiàn)時(shí)帶有和不帶有 ';'。另見 html.unescape()。

3.3 新版功能.

html.entities.entitydefs?

將 XHTML 1.0 實(shí)體定義映射到 ISO Latin-1 中的替換文本的字典。

html.entities.name2codepoint?

將 HTML 實(shí)體名稱映射到 Unicode 代碼點(diǎn)的字典。

html.entities.codepoint2name?

將 Unicode 代碼點(diǎn)映射到 HTML 實(shí)體名稱的字典。

備注

1

See https://html.spec.whatwg.org/multipage/syntax.html#named-character-references