• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1:mod:`html.entities` --- Definitions of HTML general entities
2=============================================================
3
4.. module:: html.entities
5   :synopsis: Definitions of HTML general entities.
6
7.. sectionauthor:: Fred L. Drake, Jr. <fdrake@acm.org>
8
9**Source code:** :source:`Lib/html/entities.py`
10
11--------------
12
13This module defines four dictionaries, :data:`html5`,
14:data:`name2codepoint`, :data:`codepoint2name`, and :data:`entitydefs`.
15
16
17.. data:: html5
18
19   A dictionary that maps HTML5 named character references [#]_ to the
20   equivalent Unicode character(s), e.g. ``html5['gt;'] == '>'``.
21   Note that the trailing semicolon is included in the name (e.g. ``'gt;'``),
22   however some of the names are accepted by the standard even without the
23   semicolon: in this case the name is present with and without the ``';'``.
24   See also :func:`html.unescape`.
25
26   .. versionadded:: 3.3
27
28
29.. data:: entitydefs
30
31   A dictionary mapping XHTML 1.0 entity definitions to their replacement text in
32   ISO Latin-1.
33
34
35.. data:: name2codepoint
36
37   A dictionary that maps HTML entity names to the Unicode code points.
38
39
40.. data:: codepoint2name
41
42   A dictionary that maps Unicode code points to HTML entity names.
43
44
45.. rubric:: Footnotes
46
47.. [#] See https://html.spec.whatwg.org/multipage/syntax.html#named-character-references
48