1
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
2
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
5
<html xmlns="http://www.w3.org/1999/xhtml">
7
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
9
<title>20.1. html — HyperText Markup Language support — Python 3.5.1 documentation</title>
11
<link rel="stylesheet" href="../_static/pydoctheme.css" type="text/css" />
12
<link rel="stylesheet" href="../_static/pygments.css" type="text/css" />
14
<script type="text/javascript">
15
var DOCUMENTATION_OPTIONS = {
18
COLLAPSE_INDEX: false,
23
<script type="text/javascript" src="../_static/jquery.js"></script>
24
<script type="text/javascript" src="../_static/underscore.js"></script>
25
<script type="text/javascript" src="../_static/doctools.js"></script>
26
<script type="text/javascript" src="../_static/sidebar.js"></script>
27
<link rel="search" type="application/opensearchdescription+xml"
28
title="Search within Python 3.5.1 documentation"
29
href="../_static/opensearch.xml"/>
30
<link rel="author" title="About these documents" href="../about.html" />
31
<link rel="copyright" title="Copyright" href="../copyright.html" />
32
<link rel="top" title="Python 3.5.1 documentation" href="../contents.html" />
33
<link rel="up" title="20. Structured Markup Processing Tools" href="markup.html" />
34
<link rel="next" title="20.2. html.parser — Simple HTML and XHTML parser" href="html.parser.html" />
35
<link rel="prev" title="20. Structured Markup Processing Tools" href="markup.html" />
36
<link rel="shortcut icon" type="image/png" href="../_static/py.png" />
37
<script type="text/javascript" src="../_static/copybutton.js"></script>
38
<script type="text/javascript" src="../_static/version_switch.js"></script>
43
<body role="document">
44
<div class="related" role="navigation" aria-label="related navigation">
47
<li class="right" style="margin-right: 10px">
48
<a href="../genindex.html" title="General Index"
49
accesskey="I">index</a></li>
51
<a href="../py-modindex.html" title="Python Module Index"
54
<a href="html.parser.html" title="20.2. html.parser — Simple HTML and XHTML parser"
55
accesskey="N">next</a> |</li>
57
<a href="markup.html" title="20. Structured Markup Processing Tools"
58
accesskey="P">previous</a> |</li>
59
<li><img src="../_static/py.png" alt=""
60
style="vertical-align: middle; margin-top: -1px"/></li>
61
<li><a href="https://www.python.org/">Python</a> »</li>
63
<span class="version_switcher_placeholder">3.5.1</span>
64
<a href="../index.html">Documentation </a> »
67
<li class="nav-item nav-item-1"><a href="index.html" >The Python Standard Library</a> »</li>
68
<li class="nav-item nav-item-2"><a href="markup.html" accesskey="U">20. Structured Markup Processing Tools</a> »</li>
72
<div class="document">
73
<div class="documentwrapper">
74
<div class="bodywrapper">
75
<div class="body" role="main">
77
<div class="section" id="module-html">
78
<span id="html-hypertext-markup-language-support"></span><h1>20.1. <a class="reference internal" href="#module-html" title="html: Helpers for manipulating HTML."><code class="xref py py-mod docutils literal"><span class="pre">html</span></code></a> — HyperText Markup Language support<a class="headerlink" href="#module-html" title="Permalink to this headline">¶</a></h1>
79
<p><strong>Source code:</strong> <a class="reference external" href="https://hg.python.org/cpython/file/3.5/Lib/html/__init__.py">Lib/html/__init__.py</a></p>
80
<hr class="docutils" />
81
<p>This module defines utilities to manipulate HTML.</p>
84
<code class="descclassname">html.</code><code class="descname">escape</code><span class="sig-paren">(</span><em>s</em>, <em>quote=True</em><span class="sig-paren">)</span><a class="headerlink" href="#html.escape" title="Permalink to this definition">¶</a></dt>
85
<dd><p>Convert the characters <code class="docutils literal"><span class="pre">&</span></code>, <code class="docutils literal"><span class="pre"><</span></code> and <code class="docutils literal"><span class="pre">></span></code> in string <em>s</em> to HTML-safe
86
sequences. Use this if you need to display text that might contain such
87
characters in HTML. If the optional flag <em>quote</em> is true, the characters
88
(<code class="docutils literal"><span class="pre">"</span></code>) and (<code class="docutils literal"><span class="pre">'</span></code>) are also translated; this helps for inclusion in an HTML
89
attribute value delimited by quotes, as in <code class="docutils literal"><span class="pre"><a</span> <span class="pre">href="..."></span></code>.</p>
90
<div class="versionadded">
91
<p><span class="versionmodified">New in version 3.2.</span></p>
96
<dt id="html.unescape">
97
<code class="descclassname">html.</code><code class="descname">unescape</code><span class="sig-paren">(</span><em>s</em><span class="sig-paren">)</span><a class="headerlink" href="#html.unescape" title="Permalink to this definition">¶</a></dt>
98
<dd><p>Convert all named and numeric character references (e.g. <code class="docutils literal"><span class="pre">&gt;</span></code>,
99
<code class="docutils literal"><span class="pre">&#62;</span></code>, <code class="docutils literal"><span class="pre">&x3e;</span></code>) in the string <em>s</em> to the corresponding unicode
100
characters. This function uses the rules defined by the HTML 5 standard
101
for both valid and invalid character references, and the <a class="reference internal" href="html.entities.html#html.entities.html5" title="html.entities.html5"><code class="xref py py-data docutils literal"><span class="pre">list</span> <span class="pre">of</span>
102
<span class="pre">HTML</span> <span class="pre">5</span> <span class="pre">named</span> <span class="pre">character</span> <span class="pre">references</span></code></a>.</p>
103
<div class="versionadded">
104
<p><span class="versionmodified">New in version 3.4.</span></p>
108
<hr class="docutils" />
109
<p>Submodules in the <code class="docutils literal"><span class="pre">html</span></code> package are:</p>
111
<li><a class="reference internal" href="html.parser.html#module-html.parser" title="html.parser: A simple parser that can handle HTML and XHTML."><code class="xref py py-mod docutils literal"><span class="pre">html.parser</span></code></a> – HTML/XHTML parser with lenient parsing mode</li>
112
<li><a class="reference internal" href="html.entities.html#module-html.entities" title="html.entities: Definitions of HTML general entities."><code class="xref py py-mod docutils literal"><span class="pre">html.entities</span></code></a> – HTML entity definitions</li>
120
<div class="sphinxsidebar" role="navigation" aria-label="main navigation">
121
<div class="sphinxsidebarwrapper">
122
<h4>Previous topic</h4>
123
<p class="topless"><a href="markup.html"
124
title="previous chapter">20. Structured Markup Processing Tools</a></p>
126
<p class="topless"><a href="html.parser.html"
127
title="next chapter">20.2. <code class="docutils literal"><span class="pre">html.parser</span></code> — Simple HTML and XHTML parser</a></p>
129
<ul class="this-page-menu">
130
<li><a href="../bugs.html">Report a Bug</a></li>
131
<li><a href="../_sources/library/html.txt"
132
rel="nofollow">Show Source</a></li>
135
<div id="searchbox" style="display: none" role="search">
136
<h3>Quick search</h3>
137
<form class="search" action="../search.html" method="get">
138
<input type="text" name="q" />
139
<input type="submit" value="Go" />
140
<input type="hidden" name="check_keywords" value="yes" />
141
<input type="hidden" name="area" value="default" />
143
<p class="searchtip" style="font-size: 90%">
144
Enter search terms or a module, class or function name.
147
<script type="text/javascript">$('#searchbox').show(0);</script>
150
<div class="clearer"></div>
152
<div class="related" role="navigation" aria-label="related navigation">
155
<li class="right" style="margin-right: 10px">
156
<a href="../genindex.html" title="General Index"
159
<a href="../py-modindex.html" title="Python Module Index"
162
<a href="html.parser.html" title="20.2. html.parser — Simple HTML and XHTML parser"
165
<a href="markup.html" title="20. Structured Markup Processing Tools"
167
<li><img src="../_static/py.png" alt=""
168
style="vertical-align: middle; margin-top: -1px"/></li>
169
<li><a href="https://www.python.org/">Python</a> »</li>
171
<span class="version_switcher_placeholder">3.5.1</span>
172
<a href="../index.html">Documentation </a> »
175
<li class="nav-item nav-item-1"><a href="index.html" >The Python Standard Library</a> »</li>
176
<li class="nav-item nav-item-2"><a href="markup.html" >20. Structured Markup Processing Tools</a> »</li>
180
© <a href="../copyright.html">Copyright</a> 1990-2016, Python Software Foundation.
182
The Python Software Foundation is a non-profit corporation.
183
<a href="https://www.python.org/psf/donations/">Please donate.</a>
185
Last updated on Jan 22, 2016.
186
<a href="../bugs.html">Found a bug</a>?
188
Created using <a href="http://sphinx.pocoo.org/">Sphinx</a> 1.3.3.
b'\\ No newline at end of file'