728 lines
54 KiB
HTML
728 lines
54 KiB
HTML
<!DOCTYPE html>
|
||
|
||
<html lang="en" data-content_root="../">
|
||
<head>
|
||
<meta charset="utf-8" />
|
||
<meta name="viewport" content="width=device-width, initial-scale=1.0" /><meta name="viewport" content="width=device-width, initial-scale=1" />
|
||
<meta property="og:title" content="unicodedata — Unicode Database" />
|
||
<meta property="og:type" content="website" />
|
||
<meta property="og:url" content="https://docs.python.org/3/library/unicodedata.html" />
|
||
<meta property="og:site_name" content="Python documentation" />
|
||
<meta property="og:description" content="This module provides access to the Unicode Character Database (UCD) which defines character properties for all Unicode characters. The data contained in this database is compiled from the UCD versi..." />
|
||
<meta property="og:image" content="_static/og-image.png" />
|
||
<meta property="og:image:alt" content="Python documentation" />
|
||
<meta name="description" content="This module provides access to the Unicode Character Database (UCD) which defines character properties for all Unicode characters. The data contained in this database is compiled from the UCD versi..." />
|
||
<meta name="theme-color" content="#3776ab">
|
||
<meta property="og:image:width" content="200">
|
||
<meta property="og:image:height" content="200">
|
||
|
||
<title>unicodedata — Unicode Database — Python 3.15.0 documentation</title><meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||
|
||
<link rel="stylesheet" type="text/css" href="../_static/pygments.css?v=b86133f3" />
|
||
<link rel="stylesheet" type="text/css" href="../_static/classic.css?v=234b1a7c" />
|
||
<link rel="stylesheet" type="text/css" href="../_static/pydoctheme.css?v=48df1187" />
|
||
<link id="pygments_dark_css" media="(prefers-color-scheme: dark)" rel="stylesheet" type="text/css" href="../_static/pygments_dark.css?v=0fc419ee" />
|
||
|
||
<script src="../_static/documentation_options.js?v=0fe728b1"></script>
|
||
<script src="../_static/doctools.js?v=9bcbadda"></script>
|
||
<script src="../_static/sphinx_highlight.js?v=dc90522c"></script>
|
||
|
||
<script src="../_static/sidebar.js"></script>
|
||
|
||
<link rel="search" type="application/opensearchdescription+xml"
|
||
title="Search within Python 3.15.0 documentation"
|
||
href="../_static/opensearch.xml"/>
|
||
<link rel="author" title="About these documents" href="../about.html" />
|
||
<link rel="index" title="Index" href="../genindex.html" />
|
||
<link rel="search" title="Search" href="../search.html" />
|
||
<link rel="copyright" title="Copyright" href="../copyright.html" />
|
||
<link rel="next" title="stringprep — Internet String Preparation" href="stringprep.html" />
|
||
<link rel="prev" title="textwrap — Text wrapping and filling" href="textwrap.html" />
|
||
|
||
|
||
<link rel="canonical" href="https://docs.python.org/3/library/unicodedata.html">
|
||
|
||
|
||
|
||
|
||
<style>
|
||
@media only screen {
|
||
table.full-width-table {
|
||
width: 100%;
|
||
}
|
||
}
|
||
</style>
|
||
<link rel="stylesheet" href="../_static/pydoctheme_dark.css" media="(prefers-color-scheme: dark)" id="pydoctheme_dark_css">
|
||
<link rel="shortcut icon" type="image/png" href="../_static/py.svg">
|
||
<script type="text/javascript" src="../_static/copybutton.js"></script>
|
||
<script type="text/javascript" src="../_static/menu.js"></script>
|
||
<script type="text/javascript" src="../_static/search-focus.js"></script>
|
||
<script type="text/javascript" src="../_static/themetoggle.js"></script>
|
||
<script type="text/javascript" src="../_static/rtd_switcher.js"></script>
|
||
<meta name="readthedocs-addons-api-version" content="1">
|
||
|
||
</head>
|
||
<body>
|
||
<div class="mobile-nav">
|
||
<input type="checkbox" id="menuToggler" class="toggler__input" aria-controls="navigation"
|
||
aria-pressed="false" aria-expanded="false" role="button" aria-label="Menu">
|
||
<nav class="nav-content" role="navigation">
|
||
<label for="menuToggler" class="toggler__label">
|
||
<span></span>
|
||
</label>
|
||
<span class="nav-items-wrapper">
|
||
<a href="https://www.python.org/" class="nav-logo">
|
||
<img src="../_static/py.svg" alt="Python logo">
|
||
</a>
|
||
<span class="version_switcher_placeholder"></span>
|
||
<form role="search" class="search" action="../search.html" method="get">
|
||
<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" class="search-icon">
|
||
<path fill-rule="nonzero" fill="currentColor" d="M15.5 14h-.79l-.28-.27a6.5 6.5 0 001.48-5.34c-.47-2.78-2.79-5-5.59-5.34a6.505 6.505 0 00-7.27 7.27c.34 2.8 2.56 5.12 5.34 5.59a6.5 6.5 0 005.34-1.48l.27.28v.79l4.25 4.25c.41.41 1.08.41 1.49 0 .41-.41.41-1.08 0-1.49L15.5 14zm-6 0C7.01 14 5 11.99 5 9.5S7.01 5 9.5 5 14 7.01 14 9.5 11.99 14 9.5 14z"></path>
|
||
</svg>
|
||
<input placeholder="Quick search" aria-label="Quick search" type="search" name="q">
|
||
<input type="submit" value="Go">
|
||
</form>
|
||
</span>
|
||
</nav>
|
||
<div class="menu-wrapper">
|
||
<nav class="menu" role="navigation" aria-label="main navigation">
|
||
<div class="language_switcher_placeholder"></div>
|
||
|
||
<label class="theme-selector-label">
|
||
Theme
|
||
<select class="theme-selector" oninput="activateTheme(this.value)">
|
||
<option value="auto" selected>Auto</option>
|
||
<option value="light">Light</option>
|
||
<option value="dark">Dark</option>
|
||
</select>
|
||
</label>
|
||
<div>
|
||
<h4>Previous topic</h4>
|
||
<p class="topless"><a href="textwrap.html"
|
||
title="previous chapter"><code class="xref py py-mod docutils literal notranslate"><span class="pre">textwrap</span></code> — Text wrapping and filling</a></p>
|
||
</div>
|
||
<div>
|
||
<h4>Next topic</h4>
|
||
<p class="topless"><a href="stringprep.html"
|
||
title="next chapter"><code class="xref py py-mod docutils literal notranslate"><span class="pre">stringprep</span></code> — Internet String Preparation</a></p>
|
||
</div>
|
||
<script>
|
||
document.addEventListener('DOMContentLoaded', () => {
|
||
const title = document.querySelector('meta[property="og:title"]').content;
|
||
const elements = document.querySelectorAll('.improvepage');
|
||
const pageurl = window.location.href.split('?')[0];
|
||
elements.forEach(element => {
|
||
const url = new URL(element.href.split('?')[0].replace("-nojs", ""));
|
||
url.searchParams.set('pagetitle', title);
|
||
url.searchParams.set('pageurl', pageurl);
|
||
url.searchParams.set('pagesource', "library/unicodedata.rst");
|
||
element.href = url.toString();
|
||
});
|
||
});
|
||
</script>
|
||
<div role="note" aria-label="source link">
|
||
<h3>This page</h3>
|
||
<ul class="this-page-menu">
|
||
<li><a href="../bugs.html">Report a bug</a></li>
|
||
<li><a class="improvepage" href="../improve-page-nojs.html">Improve this page</a></li>
|
||
<li>
|
||
<a href="https://github.com/python/cpython/blob/3.15/Doc/library/unicodedata.rst?plain=1"
|
||
rel="nofollow">Show source
|
||
</a>
|
||
</li>
|
||
|
||
</ul>
|
||
</div>
|
||
</nav>
|
||
</div>
|
||
</div>
|
||
|
||
|
||
<div class="related" role="navigation" aria-label="Related">
|
||
<h3>Navigation</h3>
|
||
<ul>
|
||
<li class="right" style="margin-right: 10px">
|
||
<a href="../genindex.html" title="General Index"
|
||
accesskey="I">index</a></li>
|
||
<li class="right" >
|
||
<a href="../py-modindex.html" title="Python Module Index"
|
||
>modules</a> |</li>
|
||
<li class="right" >
|
||
<a href="stringprep.html" title="stringprep — Internet String Preparation"
|
||
accesskey="N">next</a> |</li>
|
||
<li class="right" >
|
||
<a href="textwrap.html" title="textwrap — Text wrapping and filling"
|
||
accesskey="P">previous</a> |</li>
|
||
|
||
<li class="root-icon"><img src="../_static/py.svg" alt="Python logo" style="vertical-align: middle; margin-top: -1px"></li>
|
||
<li><a href="https://www.python.org/">Python</a> »</li>
|
||
<li class="switchers">
|
||
<div class="language_switcher_placeholder"></div>
|
||
<div class="version_switcher_placeholder"></div>
|
||
</li>
|
||
<li>
|
||
|
||
</li>
|
||
<li id="cpython-language-and-version">
|
||
<a href="../index.html">3.15.0 Documentation</a> »
|
||
</li>
|
||
|
||
<li class="nav-item nav-item-1"><a href="index.html" >The Python standard library</a> »</li>
|
||
<li class="nav-item nav-item-2"><a href="text.html" accesskey="U">Text Processing Services</a> »</li>
|
||
<li class="nav-item nav-item-this"><a href=""><code class="xref py py-mod docutils literal notranslate"><span class="pre">unicodedata</span></code> — Unicode Database</a></li>
|
||
<li class="right">
|
||
|
||
|
||
<div class="inline-search" role="search">
|
||
<form class="inline-search" action="../search.html" method="get">
|
||
<input placeholder="Quick search" aria-label="Quick search" type="search" name="q" id="search-box">
|
||
<input type="submit" value="Go">
|
||
</form>
|
||
</div>
|
||
|
|
||
</li>
|
||
<li class="right">
|
||
<label class="theme-selector-label">
|
||
Theme
|
||
<select class="theme-selector" oninput="activateTheme(this.value)">
|
||
<option value="auto" selected>Auto</option>
|
||
<option value="light">Light</option>
|
||
<option value="dark">Dark</option>
|
||
</select>
|
||
</label> |</li>
|
||
|
||
</ul>
|
||
</div>
|
||
|
||
<div class="document">
|
||
<div class="documentwrapper">
|
||
<div class="bodywrapper">
|
||
<div class="body" role="main">
|
||
|
||
<section id="module-unicodedata">
|
||
<span id="unicodedata-unicode-database"></span><h1><code class="xref py py-mod docutils literal notranslate"><span class="pre">unicodedata</span></code> — Unicode Database<a class="headerlink" href="#module-unicodedata" title="Link to this heading">¶</a></h1>
|
||
<hr class="docutils" id="index-0" />
|
||
<p>This module provides access to the Unicode Character Database (UCD) which
|
||
defines character properties for all Unicode characters. The data contained in
|
||
this database is compiled from the <a class="reference external" href="https://www.unicode.org/Public/17.0.0/ucd">UCD version 17.0.0</a>.</p>
|
||
<p>The module uses the same names and symbols as defined by Unicode
|
||
Standard Annex #44, <a class="reference external" href="https://www.unicode.org/reports/tr44/">“Unicode Character Database”</a>.</p>
|
||
<div class="admonition seealso">
|
||
<p class="admonition-title">See also</p>
|
||
<p>The <a class="reference internal" href="../howto/unicode.html#unicode-howto"><span class="std std-ref">Unicode HOWTO</span></a> for more information about Unicode and how to use
|
||
this module.</p>
|
||
</div>
|
||
<table class="docutils align-default">
|
||
<tbody>
|
||
<tr class="row-odd"><td colspan="2"><p><strong>Lookup</strong></p></td>
|
||
</tr>
|
||
<tr class="row-even"><td><p><a class="reference internal" href="#unicodedata.lookup" title="unicodedata.lookup"><code class="xref py py-func docutils literal notranslate"><span class="pre">lookup(name)</span></code></a></p></td>
|
||
<td><p>Look up character by name</p></td>
|
||
</tr>
|
||
<tr class="row-odd"><td><p><a class="reference internal" href="#unicodedata.name" title="unicodedata.name"><code class="xref py py-func docutils literal notranslate"><span class="pre">name(chr)</span></code></a></p></td>
|
||
<td><p>Return the name assigned to a character</p></td>
|
||
</tr>
|
||
<tr class="row-even"><td colspan="2"><p><strong>Numeric values</strong></p></td>
|
||
</tr>
|
||
<tr class="row-odd"><td><p><a class="reference internal" href="decimal.html#module-decimal" title="decimal: Implementation of the General Decimal Arithmetic Specification."><code class="xref py py-func docutils literal notranslate"><span class="pre">decimal(chr)</span></code></a></p></td>
|
||
<td><p>Decimal value of a character</p></td>
|
||
</tr>
|
||
<tr class="row-even"><td><p><a class="reference internal" href="#unicodedata.digit" title="unicodedata.digit"><code class="xref py py-func docutils literal notranslate"><span class="pre">digit(chr)</span></code></a></p></td>
|
||
<td><p>Digit value of a character</p></td>
|
||
</tr>
|
||
<tr class="row-odd"><td><p><a class="reference internal" href="#unicodedata.numeric" title="unicodedata.numeric"><code class="xref py py-func docutils literal notranslate"><span class="pre">numeric(chr)</span></code></a></p></td>
|
||
<td><p>Numeric value of a character</p></td>
|
||
</tr>
|
||
<tr class="row-even"><td colspan="2"><p><strong>Properties</strong></p></td>
|
||
</tr>
|
||
<tr class="row-odd"><td><p><a class="reference internal" href="#unicodedata.bidirectional" title="unicodedata.bidirectional"><code class="xref py py-func docutils literal notranslate"><span class="pre">bidirectional(chr)</span></code></a></p></td>
|
||
<td><p>Bidirectional class of a character</p></td>
|
||
</tr>
|
||
<tr class="row-even"><td><p><a class="reference internal" href="#unicodedata.block" title="unicodedata.block"><code class="xref py py-func docutils literal notranslate"><span class="pre">block(chr)</span></code></a></p></td>
|
||
<td><p>Unicode block of a character</p></td>
|
||
</tr>
|
||
<tr class="row-odd"><td><p><a class="reference internal" href="#unicodedata.category" title="unicodedata.category"><code class="xref py py-func docutils literal notranslate"><span class="pre">category(chr)</span></code></a></p></td>
|
||
<td><p>General category of a character</p></td>
|
||
</tr>
|
||
<tr class="row-even"><td><p><a class="reference internal" href="#unicodedata.combining" title="unicodedata.combining"><code class="xref py py-func docutils literal notranslate"><span class="pre">combining(chr)</span></code></a></p></td>
|
||
<td><p>Canonical combining class of a character</p></td>
|
||
</tr>
|
||
<tr class="row-odd"><td><p><a class="reference internal" href="#unicodedata.decomposition" title="unicodedata.decomposition"><code class="xref py py-func docutils literal notranslate"><span class="pre">decomposition(chr)</span></code></a></p></td>
|
||
<td><p>Character decomposition mapping</p></td>
|
||
</tr>
|
||
<tr class="row-even"><td><p><a class="reference internal" href="#unicodedata.east_asian_width" title="unicodedata.east_asian_width"><code class="xref py py-func docutils literal notranslate"><span class="pre">east_asian_width(chr)</span></code></a></p></td>
|
||
<td><p>East Asian width of a character</p></td>
|
||
</tr>
|
||
<tr class="row-odd"><td><p><a class="reference internal" href="#unicodedata.extended_pictographic" title="unicodedata.extended_pictographic"><code class="xref py py-func docutils literal notranslate"><span class="pre">extended_pictographic(chr)</span></code></a></p></td>
|
||
<td><p>Check if a character has the Extended_Pictographic property</p></td>
|
||
</tr>
|
||
<tr class="row-even"><td><p><a class="reference internal" href="#unicodedata.grapheme_cluster_break" title="unicodedata.grapheme_cluster_break"><code class="xref py py-func docutils literal notranslate"><span class="pre">grapheme_cluster_break(chr)</span></code></a></p></td>
|
||
<td><p>Grapheme_Cluster_Break property of a character</p></td>
|
||
</tr>
|
||
<tr class="row-odd"><td><p><a class="reference internal" href="#unicodedata.indic_conjunct_break" title="unicodedata.indic_conjunct_break"><code class="xref py py-func docutils literal notranslate"><span class="pre">indic_conjunct_break(chr)</span></code></a></p></td>
|
||
<td><p>Indic_Conjunct_Break property of a character</p></td>
|
||
</tr>
|
||
<tr class="row-even"><td><p><a class="reference internal" href="#unicodedata.isxidcontinue" title="unicodedata.isxidcontinue"><code class="xref py py-func docutils literal notranslate"><span class="pre">isxidcontinue(chr)</span></code></a></p></td>
|
||
<td><p>Check if a character is a valid identifier continuation</p></td>
|
||
</tr>
|
||
<tr class="row-odd"><td><p><a class="reference internal" href="#unicodedata.isxidstart" title="unicodedata.isxidstart"><code class="xref py py-func docutils literal notranslate"><span class="pre">isxidstart(chr)</span></code></a></p></td>
|
||
<td><p>Check if a character is a valid identifier start</p></td>
|
||
</tr>
|
||
<tr class="row-even"><td><p><a class="reference internal" href="#unicodedata.mirrored" title="unicodedata.mirrored"><code class="xref py py-func docutils literal notranslate"><span class="pre">mirrored(chr)</span></code></a></p></td>
|
||
<td><p>Mirrored property of a character</p></td>
|
||
</tr>
|
||
<tr class="row-odd"><td colspan="2"><p><strong>Normalization</strong></p></td>
|
||
</tr>
|
||
<tr class="row-even"><td><p><a class="reference internal" href="#unicodedata.normalize" title="unicodedata.normalize"><code class="xref py py-func docutils literal notranslate"><span class="pre">normalize(form,</span> <span class="pre">unistr)</span></code></a></p></td>
|
||
<td><p>Return the normalized form of a string</p></td>
|
||
</tr>
|
||
<tr class="row-odd"><td><p><a class="reference internal" href="#unicodedata.is_normalized" title="unicodedata.is_normalized"><code class="xref py py-func docutils literal notranslate"><span class="pre">is_normalized(form,</span> <span class="pre">unistr)</span></code></a></p></td>
|
||
<td><p>Check if a Unicode string is normalized</p></td>
|
||
</tr>
|
||
<tr class="row-even"><td colspan="2"><p><strong>Text segmentation</strong></p></td>
|
||
</tr>
|
||
<tr class="row-odd"><td><p><a class="reference internal" href="#unicodedata.iter_graphemes" title="unicodedata.iter_graphemes"><code class="xref py py-func docutils literal notranslate"><span class="pre">iter_graphemes(unistr)</span></code></a></p></td>
|
||
<td><p>Iterate over grapheme clusters in a string</p></td>
|
||
</tr>
|
||
</tbody>
|
||
</table>
|
||
<dl class="py function">
|
||
<dt class="sig sig-object py" id="unicodedata.lookup">
|
||
<span class="sig-prename descclassname"><span class="pre">unicodedata.</span></span><span class="sig-name descname"><span class="pre">lookup</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">name</span></span></em>, <em class="sig-param"><span class="positional-only-separator o"><abbr title="Positional-only parameter separator (PEP 570)"><span class="pre">/</span></abbr></span></em><span class="sig-paren">)</span><a class="headerlink" href="#unicodedata.lookup" title="Link to this definition">¶</a></dt>
|
||
<dd><p>Look up character by name. If a character with the given name is found, return
|
||
the corresponding character. If not found, <a class="reference internal" href="../builtins/exceptions.html#KeyError" title="KeyError"><code class="xref py py-exc docutils literal notranslate"><span class="pre">KeyError</span></code></a> is raised.
|
||
For example:</p>
|
||
<div class="highlight-python3 notranslate"><div class="highlight"><pre><span></span><span class="gp">>>> </span><span class="n">unicodedata</span><span class="o">.</span><span class="n">lookup</span><span class="p">(</span><span class="s1">'LEFT CURLY BRACKET'</span><span class="p">)</span>
|
||
<span class="go">'{'</span>
|
||
</pre></div>
|
||
</div>
|
||
<p>The characters returned by this function are the same as those produced by
|
||
<code class="docutils literal notranslate"><span class="pre">\N</span></code> escape sequence in string literals. For example:</p>
|
||
<div class="highlight-python3 notranslate"><div class="highlight"><pre><span></span><span class="gp">>>> </span><span class="n">unicodedata</span><span class="o">.</span><span class="n">lookup</span><span class="p">(</span><span class="s1">'MIDDLE DOT'</span><span class="p">)</span> <span class="o">==</span> <span class="s1">'</span><span class="se">\N{MIDDLE DOT}</span><span class="s1">'</span>
|
||
<span class="go">True</span>
|
||
</pre></div>
|
||
</div>
|
||
<div class="versionchanged">
|
||
<p><span class="versionmodified changed">Changed in version 3.3: </span>Support for name aliases <a class="footnote-reference brackets" href="#id4" id="id1" role="doc-noteref"><span class="fn-bracket">[</span>1<span class="fn-bracket">]</span></a> and named sequences <a class="footnote-reference brackets" href="#id5" id="id2" role="doc-noteref"><span class="fn-bracket">[</span>2<span class="fn-bracket">]</span></a> has been added.</p>
|
||
</div>
|
||
</dd></dl>
|
||
|
||
<dl class="py function">
|
||
<dt class="sig sig-object py" id="unicodedata.name">
|
||
<span class="sig-prename descclassname"><span class="pre">unicodedata.</span></span><span class="sig-name descname"><span class="pre">name</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">chr</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">default</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></em>, <em class="sig-param"><span class="positional-only-separator o"><abbr title="Positional-only parameter separator (PEP 570)"><span class="pre">/</span></abbr></span></em><span class="sig-paren">)</span><a class="headerlink" href="#unicodedata.name" title="Link to this definition">¶</a></dt>
|
||
<dd><p>Returns the name assigned to the character <em>chr</em> as a string. If no
|
||
name is defined, <em>default</em> is returned, or, if not given, <a class="reference internal" href="../builtins/exceptions.html#ValueError" title="ValueError"><code class="xref py py-exc docutils literal notranslate"><span class="pre">ValueError</span></code></a> is
|
||
raised. For example:</p>
|
||
<div class="highlight-python3 notranslate"><div class="highlight"><pre><span></span><span class="gp">>>> </span><span class="n">unicodedata</span><span class="o">.</span><span class="n">name</span><span class="p">(</span><span class="s1">'½'</span><span class="p">)</span>
|
||
<span class="go">'VULGAR FRACTION ONE HALF'</span>
|
||
<span class="gp">>>> </span><span class="n">unicodedata</span><span class="o">.</span><span class="n">name</span><span class="p">(</span><span class="s1">'</span><span class="se">\uFFFF</span><span class="s1">'</span><span class="p">,</span> <span class="s1">'fallback'</span><span class="p">)</span>
|
||
<span class="go">'fallback'</span>
|
||
</pre></div>
|
||
</div>
|
||
</dd></dl>
|
||
|
||
<dl class="py function">
|
||
<dt class="sig sig-object py" id="unicodedata.decimal">
|
||
<span class="sig-prename descclassname"><span class="pre">unicodedata.</span></span><span class="sig-name descname"><span class="pre">decimal</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">chr</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">default</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></em>, <em class="sig-param"><span class="positional-only-separator o"><abbr title="Positional-only parameter separator (PEP 570)"><span class="pre">/</span></abbr></span></em><span class="sig-paren">)</span><a class="headerlink" href="#unicodedata.decimal" title="Link to this definition">¶</a></dt>
|
||
<dd><p>Returns the decimal value assigned to the character <em>chr</em> as integer.
|
||
If no such value is defined, <em>default</em> is returned, or, if not given,
|
||
<a class="reference internal" href="../builtins/exceptions.html#ValueError" title="ValueError"><code class="xref py py-exc docutils literal notranslate"><span class="pre">ValueError</span></code></a> is raised. For example:</p>
|
||
<div class="highlight-python3 notranslate"><div class="highlight"><pre><span></span><span class="gp">>>> </span><span class="n">unicodedata</span><span class="o">.</span><span class="n">decimal</span><span class="p">(</span><span class="s1">'</span><span class="se">\N{ARABIC-INDIC DIGIT NINE}</span><span class="s1">'</span><span class="p">)</span>
|
||
<span class="go">9</span>
|
||
<span class="gp">>>> </span><span class="n">unicodedata</span><span class="o">.</span><span class="n">decimal</span><span class="p">(</span><span class="s1">'</span><span class="se">\N{SUPERSCRIPT NINE}</span><span class="s1">'</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">)</span>
|
||
<span class="go">-1</span>
|
||
</pre></div>
|
||
</div>
|
||
</dd></dl>
|
||
|
||
<dl class="py function">
|
||
<dt class="sig sig-object py" id="unicodedata.digit">
|
||
<span class="sig-prename descclassname"><span class="pre">unicodedata.</span></span><span class="sig-name descname"><span class="pre">digit</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">chr</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">default</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></em>, <em class="sig-param"><span class="positional-only-separator o"><abbr title="Positional-only parameter separator (PEP 570)"><span class="pre">/</span></abbr></span></em><span class="sig-paren">)</span><a class="headerlink" href="#unicodedata.digit" title="Link to this definition">¶</a></dt>
|
||
<dd><p>Returns the digit value assigned to the character <em>chr</em> as integer.
|
||
If no such value is defined, <em>default</em> is returned, or, if not given,
|
||
<a class="reference internal" href="../builtins/exceptions.html#ValueError" title="ValueError"><code class="xref py py-exc docutils literal notranslate"><span class="pre">ValueError</span></code></a> is raised:</p>
|
||
<div class="highlight-python3 notranslate"><div class="highlight"><pre><span></span><span class="gp">>>> </span><span class="n">unicodedata</span><span class="o">.</span><span class="n">digit</span><span class="p">(</span><span class="s1">'</span><span class="se">\N{SUPERSCRIPT NINE}</span><span class="s1">'</span><span class="p">)</span>
|
||
<span class="go">9</span>
|
||
</pre></div>
|
||
</div>
|
||
</dd></dl>
|
||
|
||
<dl class="py function">
|
||
<dt class="sig sig-object py" id="unicodedata.numeric">
|
||
<span class="sig-prename descclassname"><span class="pre">unicodedata.</span></span><span class="sig-name descname"><span class="pre">numeric</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">chr</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">default</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></em>, <em class="sig-param"><span class="positional-only-separator o"><abbr title="Positional-only parameter separator (PEP 570)"><span class="pre">/</span></abbr></span></em><span class="sig-paren">)</span><a class="headerlink" href="#unicodedata.numeric" title="Link to this definition">¶</a></dt>
|
||
<dd><p>Returns the numeric value assigned to the character <em>chr</em> as float.
|
||
If no such value is defined, <em>default</em> is returned, or, if not given,
|
||
<a class="reference internal" href="../builtins/exceptions.html#ValueError" title="ValueError"><code class="xref py py-exc docutils literal notranslate"><span class="pre">ValueError</span></code></a> is raised:</p>
|
||
<div class="highlight-python3 notranslate"><div class="highlight"><pre><span></span><span class="gp">>>> </span><span class="n">unicodedata</span><span class="o">.</span><span class="n">numeric</span><span class="p">(</span><span class="s1">'½'</span><span class="p">)</span>
|
||
<span class="go">0.5</span>
|
||
</pre></div>
|
||
</div>
|
||
</dd></dl>
|
||
|
||
<dl class="py function">
|
||
<dt class="sig sig-object py" id="unicodedata.category">
|
||
<span class="sig-prename descclassname"><span class="pre">unicodedata.</span></span><span class="sig-name descname"><span class="pre">category</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">chr</span></span></em>, <em class="sig-param"><span class="positional-only-separator o"><abbr title="Positional-only parameter separator (PEP 570)"><span class="pre">/</span></abbr></span></em><span class="sig-paren">)</span><a class="headerlink" href="#unicodedata.category" title="Link to this definition">¶</a></dt>
|
||
<dd><p>Returns the general category assigned to the character <em>chr</em> as
|
||
string. General category names consist of two letters.
|
||
See the <a class="reference external" href="https://www.unicode.org/reports/tr44/#General_Category_Values">General Category Values section of the Unicode Character
|
||
Database documentation</a>
|
||
for a list of category codes. For example:</p>
|
||
<div class="highlight-python3 notranslate"><div class="highlight"><pre><span></span><span class="gp">>>> </span><span class="n">unicodedata</span><span class="o">.</span><span class="n">category</span><span class="p">(</span><span class="s1">'A'</span><span class="p">)</span> <span class="c1"># 'L'etter, 'u'ppercase</span>
|
||
<span class="go">'Lu'</span>
|
||
</pre></div>
|
||
</div>
|
||
</dd></dl>
|
||
|
||
<dl class="py function">
|
||
<dt class="sig sig-object py" id="unicodedata.bidirectional">
|
||
<span class="sig-prename descclassname"><span class="pre">unicodedata.</span></span><span class="sig-name descname"><span class="pre">bidirectional</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">chr</span></span></em>, <em class="sig-param"><span class="positional-only-separator o"><abbr title="Positional-only parameter separator (PEP 570)"><span class="pre">/</span></abbr></span></em><span class="sig-paren">)</span><a class="headerlink" href="#unicodedata.bidirectional" title="Link to this definition">¶</a></dt>
|
||
<dd><p>Returns the bidirectional class assigned to the character <em>chr</em> as
|
||
string. If no such value is defined, an empty string is returned.
|
||
See the <a class="reference external" href="https://www.unicode.org/reports/tr44/#Bidi_Class_Values">Bidirectional Class Values section of the Unicode Character
|
||
Database</a>
|
||
documentation for a list of bidirectional codes. For example:</p>
|
||
<div class="highlight-python3 notranslate"><div class="highlight"><pre><span></span><span class="gp">>>> </span><span class="n">unicodedata</span><span class="o">.</span><span class="n">bidirectional</span><span class="p">(</span><span class="s1">'</span><span class="se">\N{ARABIC-INDIC DIGIT SEVEN}</span><span class="s1">'</span><span class="p">)</span> <span class="c1"># 'A'rabic, 'N'umber</span>
|
||
<span class="go">'AN'</span>
|
||
</pre></div>
|
||
</div>
|
||
</dd></dl>
|
||
|
||
<dl class="py function">
|
||
<dt class="sig sig-object py" id="unicodedata.combining">
|
||
<span class="sig-prename descclassname"><span class="pre">unicodedata.</span></span><span class="sig-name descname"><span class="pre">combining</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">chr</span></span></em>, <em class="sig-param"><span class="positional-only-separator o"><abbr title="Positional-only parameter separator (PEP 570)"><span class="pre">/</span></abbr></span></em><span class="sig-paren">)</span><a class="headerlink" href="#unicodedata.combining" title="Link to this definition">¶</a></dt>
|
||
<dd><p>Returns the canonical combining class assigned to the character <em>chr</em>
|
||
as integer. Returns <code class="docutils literal notranslate"><span class="pre">0</span></code> if no combining class is defined.
|
||
See the <a class="reference external" href="https://www.unicode.org/reports/tr44/#Canonical_Combining_Class_Values">Canonical Combining Class Values section of the Unicode Character
|
||
Database</a>
|
||
for more information.</p>
|
||
</dd></dl>
|
||
|
||
<dl class="py function">
|
||
<dt class="sig sig-object py" id="unicodedata.east_asian_width">
|
||
<span class="sig-prename descclassname"><span class="pre">unicodedata.</span></span><span class="sig-name descname"><span class="pre">east_asian_width</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">chr</span></span></em>, <em class="sig-param"><span class="positional-only-separator o"><abbr title="Positional-only parameter separator (PEP 570)"><span class="pre">/</span></abbr></span></em><span class="sig-paren">)</span><a class="headerlink" href="#unicodedata.east_asian_width" title="Link to this definition">¶</a></dt>
|
||
<dd><p>Returns the east asian width assigned to the character <em>chr</em> as
|
||
string. For a list of widths and or more information, see the
|
||
<a class="reference external" href="https://www.unicode.org/reports/tr11/">Unicode Standard Annex #11</a>.</p>
|
||
</dd></dl>
|
||
|
||
<dl class="py function">
|
||
<dt class="sig sig-object py" id="unicodedata.block">
|
||
<span class="sig-prename descclassname"><span class="pre">unicodedata.</span></span><span class="sig-name descname"><span class="pre">block</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">chr</span></span></em>, <em class="sig-param"><span class="positional-only-separator o"><abbr title="Positional-only parameter separator (PEP 570)"><span class="pre">/</span></abbr></span></em><span class="sig-paren">)</span><a class="headerlink" href="#unicodedata.block" title="Link to this definition">¶</a></dt>
|
||
<dd><p>Returns the <a class="reference external" href="https://www.unicode.org/versions/Unicode17.0.0/core-spec/chapter-3/#G64189">block</a>
|
||
assigned to the character <em>chr</em>. For example:</p>
|
||
<div class="highlight-python3 notranslate"><div class="highlight"><pre><span></span><span class="gp">>>> </span><span class="n">unicodedata</span><span class="o">.</span><span class="n">block</span><span class="p">(</span><span class="s1">'S'</span><span class="p">)</span>
|
||
<span class="go">'Basic Latin'</span>
|
||
</pre></div>
|
||
</div>
|
||
<div class="versionadded">
|
||
<p><span class="versionmodified added">Added in version 3.15.</span></p>
|
||
</div>
|
||
</dd></dl>
|
||
|
||
<dl class="py function">
|
||
<dt class="sig sig-object py" id="unicodedata.mirrored">
|
||
<span class="sig-prename descclassname"><span class="pre">unicodedata.</span></span><span class="sig-name descname"><span class="pre">mirrored</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">chr</span></span></em>, <em class="sig-param"><span class="positional-only-separator o"><abbr title="Positional-only parameter separator (PEP 570)"><span class="pre">/</span></abbr></span></em><span class="sig-paren">)</span><a class="headerlink" href="#unicodedata.mirrored" title="Link to this definition">¶</a></dt>
|
||
<dd><p>Returns the mirrored property assigned to the character <em>chr</em> as
|
||
integer. Returns <code class="docutils literal notranslate"><span class="pre">1</span></code> if the character has been identified as a “mirrored”
|
||
character in bidirectional text, <code class="docutils literal notranslate"><span class="pre">0</span></code> otherwise. For example:</p>
|
||
<div class="highlight-python3 notranslate"><div class="highlight"><pre><span></span><span class="gp">>>> </span><span class="n">unicodedata</span><span class="o">.</span><span class="n">mirrored</span><span class="p">(</span><span class="s1">'>'</span><span class="p">)</span>
|
||
<span class="go">1</span>
|
||
</pre></div>
|
||
</div>
|
||
</dd></dl>
|
||
|
||
<dl class="py function">
|
||
<dt class="sig sig-object py" id="unicodedata.isxidstart">
|
||
<span class="sig-prename descclassname"><span class="pre">unicodedata.</span></span><span class="sig-name descname"><span class="pre">isxidstart</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">chr</span></span></em>, <em class="sig-param"><span class="positional-only-separator o"><abbr title="Positional-only parameter separator (PEP 570)"><span class="pre">/</span></abbr></span></em><span class="sig-paren">)</span><a class="headerlink" href="#unicodedata.isxidstart" title="Link to this definition">¶</a></dt>
|
||
<dd><p>Return <code class="docutils literal notranslate"><span class="pre">True</span></code> if <em>chr</em> is a valid identifier start per the
|
||
<a class="reference external" href="https://www.unicode.org/reports/tr31/">Unicode Standard Annex #31</a>,
|
||
that is, it has the <code class="docutils literal notranslate"><span class="pre">XID_Start</span></code> property. Return <code class="docutils literal notranslate"><span class="pre">False</span></code> otherwise.
|
||
For example:</p>
|
||
<div class="highlight-python3 notranslate"><div class="highlight"><pre><span></span><span class="gp">>>> </span><span class="n">unicodedata</span><span class="o">.</span><span class="n">isxidstart</span><span class="p">(</span><span class="s1">'S'</span><span class="p">)</span>
|
||
<span class="go">True</span>
|
||
<span class="gp">>>> </span><span class="n">unicodedata</span><span class="o">.</span><span class="n">isxidstart</span><span class="p">(</span><span class="s1">'0'</span><span class="p">)</span>
|
||
<span class="go">False</span>
|
||
</pre></div>
|
||
</div>
|
||
<div class="versionadded">
|
||
<p><span class="versionmodified added">Added in version 3.15.</span></p>
|
||
</div>
|
||
</dd></dl>
|
||
|
||
<dl class="py function">
|
||
<dt class="sig sig-object py" id="unicodedata.isxidcontinue">
|
||
<span class="sig-prename descclassname"><span class="pre">unicodedata.</span></span><span class="sig-name descname"><span class="pre">isxidcontinue</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">chr</span></span></em>, <em class="sig-param"><span class="positional-only-separator o"><abbr title="Positional-only parameter separator (PEP 570)"><span class="pre">/</span></abbr></span></em><span class="sig-paren">)</span><a class="headerlink" href="#unicodedata.isxidcontinue" title="Link to this definition">¶</a></dt>
|
||
<dd><p>Return <code class="docutils literal notranslate"><span class="pre">True</span></code> if <em>chr</em> is a valid identifier character per the
|
||
<a class="reference external" href="https://www.unicode.org/reports/tr31/">Unicode Standard Annex #31</a>,
|
||
that is, it has the <code class="docutils literal notranslate"><span class="pre">XID_Continue</span></code> property. Return <code class="docutils literal notranslate"><span class="pre">False</span></code> otherwise.
|
||
For example:</p>
|
||
<div class="highlight-python3 notranslate"><div class="highlight"><pre><span></span><span class="gp">>>> </span><span class="n">unicodedata</span><span class="o">.</span><span class="n">isxidcontinue</span><span class="p">(</span><span class="s1">'S'</span><span class="p">)</span>
|
||
<span class="go">True</span>
|
||
<span class="gp">>>> </span><span class="n">unicodedata</span><span class="o">.</span><span class="n">isxidcontinue</span><span class="p">(</span><span class="s1">' '</span><span class="p">)</span>
|
||
<span class="go">False</span>
|
||
</pre></div>
|
||
</div>
|
||
<div class="versionadded">
|
||
<p><span class="versionmodified added">Added in version 3.15.</span></p>
|
||
</div>
|
||
</dd></dl>
|
||
|
||
<dl class="py function">
|
||
<dt class="sig sig-object py" id="unicodedata.decomposition">
|
||
<span class="sig-prename descclassname"><span class="pre">unicodedata.</span></span><span class="sig-name descname"><span class="pre">decomposition</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">chr</span></span></em>, <em class="sig-param"><span class="positional-only-separator o"><abbr title="Positional-only parameter separator (PEP 570)"><span class="pre">/</span></abbr></span></em><span class="sig-paren">)</span><a class="headerlink" href="#unicodedata.decomposition" title="Link to this definition">¶</a></dt>
|
||
<dd><p>Returns the character decomposition mapping assigned to the character
|
||
<em>chr</em> as string. An empty string is returned in case no such mapping is
|
||
defined. For example:</p>
|
||
<div class="highlight-python3 notranslate"><div class="highlight"><pre><span></span><span class="gp">>>> </span><span class="n">unicodedata</span><span class="o">.</span><span class="n">decomposition</span><span class="p">(</span><span class="s1">'Ã'</span><span class="p">)</span>
|
||
<span class="go">'0041 0303'</span>
|
||
</pre></div>
|
||
</div>
|
||
</dd></dl>
|
||
|
||
<dl class="py function">
|
||
<dt class="sig sig-object py" id="unicodedata.grapheme_cluster_break">
|
||
<span class="sig-prename descclassname"><span class="pre">unicodedata.</span></span><span class="sig-name descname"><span class="pre">grapheme_cluster_break</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">chr</span></span></em>, <em class="sig-param"><span class="positional-only-separator o"><abbr title="Positional-only parameter separator (PEP 570)"><span class="pre">/</span></abbr></span></em><span class="sig-paren">)</span><a class="headerlink" href="#unicodedata.grapheme_cluster_break" title="Link to this definition">¶</a></dt>
|
||
<dd><p>Returns the Grapheme_Cluster_Break property assigned to the character.</p>
|
||
<div class="versionadded">
|
||
<p><span class="versionmodified added">Added in version 3.15.</span></p>
|
||
</div>
|
||
</dd></dl>
|
||
|
||
<dl class="py function">
|
||
<dt class="sig sig-object py" id="unicodedata.indic_conjunct_break">
|
||
<span class="sig-prename descclassname"><span class="pre">unicodedata.</span></span><span class="sig-name descname"><span class="pre">indic_conjunct_break</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">chr</span></span></em>, <em class="sig-param"><span class="positional-only-separator o"><abbr title="Positional-only parameter separator (PEP 570)"><span class="pre">/</span></abbr></span></em><span class="sig-paren">)</span><a class="headerlink" href="#unicodedata.indic_conjunct_break" title="Link to this definition">¶</a></dt>
|
||
<dd><p>Returns the Indic_Conjunct_Break property assigned to the character.</p>
|
||
<div class="versionadded">
|
||
<p><span class="versionmodified added">Added in version 3.15.</span></p>
|
||
</div>
|
||
</dd></dl>
|
||
|
||
<dl class="py function">
|
||
<dt class="sig sig-object py" id="unicodedata.extended_pictographic">
|
||
<span class="sig-prename descclassname"><span class="pre">unicodedata.</span></span><span class="sig-name descname"><span class="pre">extended_pictographic</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">chr</span></span></em>, <em class="sig-param"><span class="positional-only-separator o"><abbr title="Positional-only parameter separator (PEP 570)"><span class="pre">/</span></abbr></span></em><span class="sig-paren">)</span><a class="headerlink" href="#unicodedata.extended_pictographic" title="Link to this definition">¶</a></dt>
|
||
<dd><p>Returns <code class="docutils literal notranslate"><span class="pre">True</span></code> if the character has the Extended_Pictographic property,
|
||
<code class="docutils literal notranslate"><span class="pre">False</span></code> otherwise.</p>
|
||
<div class="versionadded">
|
||
<p><span class="versionmodified added">Added in version 3.15.</span></p>
|
||
</div>
|
||
</dd></dl>
|
||
|
||
<dl class="py function">
|
||
<dt class="sig sig-object py" id="unicodedata.normalize">
|
||
<span class="sig-prename descclassname"><span class="pre">unicodedata.</span></span><span class="sig-name descname"><span class="pre">normalize</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">form</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">unistr</span></span></em>, <em class="sig-param"><span class="positional-only-separator o"><abbr title="Positional-only parameter separator (PEP 570)"><span class="pre">/</span></abbr></span></em><span class="sig-paren">)</span><a class="headerlink" href="#unicodedata.normalize" title="Link to this definition">¶</a></dt>
|
||
<dd><p>Return the normal form <em>form</em> for the Unicode string <em>unistr</em>. Valid values for
|
||
<em>form</em> are ‘NFC’, ‘NFKC’, ‘NFD’, and ‘NFKD’.</p>
|
||
<p>The Unicode standard defines various normalization forms of a Unicode string,
|
||
based on the definition of canonical equivalence and compatibility equivalence.
|
||
In Unicode, several characters can be expressed in various way. For example, the
|
||
character U+00C7 (LATIN CAPITAL LETTER C WITH CEDILLA) can also be expressed as
|
||
the sequence U+0043 (LATIN CAPITAL LETTER C) U+0327 (COMBINING CEDILLA).</p>
|
||
<p>For each character, there are two normal forms: normal form C and normal form D.
|
||
Normal form D (NFD) is also known as canonical decomposition, and translates
|
||
each character into its decomposed form. Normal form C (NFC) first applies a
|
||
canonical decomposition, then composes pre-combined characters again.</p>
|
||
<p>In addition to these two forms, there are two additional normal forms based on
|
||
compatibility equivalence. In Unicode, certain characters are supported which
|
||
normally would be unified with other characters. For example, U+2160 (ROMAN
|
||
NUMERAL ONE) is really the same thing as U+0049 (LATIN CAPITAL LETTER I).
|
||
However, it is supported in Unicode for compatibility with existing character
|
||
sets (for example, gb2312).</p>
|
||
<p>The normal form KD (NFKD) will apply the compatibility decomposition, that is,
|
||
replace all compatibility characters with their equivalents. The normal form KC
|
||
(NFKC) first applies the compatibility decomposition, followed by the canonical
|
||
composition.</p>
|
||
<p>Even if two unicode strings are normalized and look the same to
|
||
a human reader, if one has combining characters and the other
|
||
doesn’t, they may not compare equal.</p>
|
||
</dd></dl>
|
||
|
||
<dl class="py function">
|
||
<dt class="sig sig-object py" id="unicodedata.is_normalized">
|
||
<span class="sig-prename descclassname"><span class="pre">unicodedata.</span></span><span class="sig-name descname"><span class="pre">is_normalized</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">form</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">unistr</span></span></em>, <em class="sig-param"><span class="positional-only-separator o"><abbr title="Positional-only parameter separator (PEP 570)"><span class="pre">/</span></abbr></span></em><span class="sig-paren">)</span><a class="headerlink" href="#unicodedata.is_normalized" title="Link to this definition">¶</a></dt>
|
||
<dd><p>Return whether the Unicode string <em>unistr</em> is in the normal form <em>form</em>. Valid
|
||
values for <em>form</em> are ‘NFC’, ‘NFKC’, ‘NFD’, and ‘NFKD’.</p>
|
||
<div class="versionadded">
|
||
<p><span class="versionmodified added">Added in version 3.8.</span></p>
|
||
</div>
|
||
</dd></dl>
|
||
|
||
<dl class="py function">
|
||
<dt class="sig sig-object py" id="unicodedata.iter_graphemes">
|
||
<span class="sig-prename descclassname"><span class="pre">unicodedata.</span></span><span class="sig-name descname"><span class="pre">iter_graphemes</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">unistr</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">start</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">0</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">end</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">sys.maxsize</span></span></em>, <em class="sig-param"><span class="positional-only-separator o"><abbr title="Positional-only parameter separator (PEP 570)"><span class="pre">/</span></abbr></span></em><span class="sig-paren">)</span><a class="headerlink" href="#unicodedata.iter_graphemes" title="Link to this definition">¶</a></dt>
|
||
<dd><p>Returns an iterator to iterate over grapheme clusters.
|
||
With optional <em>start</em>, iteration begins at that position.
|
||
With optional <em>end</em>, iteration stops at that position.</p>
|
||
<p>Converting an emitted item to string returns a substring corresponding to
|
||
the grapheme cluster.
|
||
Its <code class="docutils literal notranslate"><span class="pre">start</span></code> and <code class="docutils literal notranslate"><span class="pre">end</span></code> attributes denote the start and end of
|
||
the grapheme cluster.</p>
|
||
<p>It uses extended grapheme cluster rules defined by Unicode
|
||
Standard Annex #29, <a class="reference external" href="https://www.unicode.org/reports/tr29/">“Unicode Text Segmentation”</a>.</p>
|
||
<div class="versionadded">
|
||
<p><span class="versionmodified added">Added in version 3.15.</span></p>
|
||
</div>
|
||
</dd></dl>
|
||
|
||
<p>In addition, the module exposes the following constants:</p>
|
||
<dl class="py data">
|
||
<dt class="sig sig-object py" id="unicodedata.unidata_version">
|
||
<span class="sig-prename descclassname"><span class="pre">unicodedata.</span></span><span class="sig-name descname"><span class="pre">unidata_version</span></span><a class="headerlink" href="#unicodedata.unidata_version" title="Link to this definition">¶</a></dt>
|
||
<dd><p>The version of the Unicode database used in this module.</p>
|
||
</dd></dl>
|
||
|
||
<dl class="py data">
|
||
<dt class="sig sig-object py" id="unicodedata.ucd_3_2_0">
|
||
<span class="sig-prename descclassname"><span class="pre">unicodedata.</span></span><span class="sig-name descname"><span class="pre">ucd_3_2_0</span></span><a class="headerlink" href="#unicodedata.ucd_3_2_0" title="Link to this definition">¶</a></dt>
|
||
<dd><p>This is an object that has most of the methods of the entire module, but uses the
|
||
Unicode database version 3.2 instead, for applications that require this
|
||
specific version of the Unicode database (such as IDNA).</p>
|
||
</dd></dl>
|
||
|
||
<p class="rubric">Footnotes</p>
|
||
<aside class="footnote-list brackets">
|
||
<aside class="footnote brackets" id="id4" role="doc-footnote">
|
||
<span class="label"><span class="fn-bracket">[</span><a role="doc-backlink" href="#id1">1</a><span class="fn-bracket">]</span></span>
|
||
<p><a class="reference external" href="https://www.unicode.org/Public/17.0.0/ucd/NameAliases.txt">https://www.unicode.org/Public/17.0.0/ucd/NameAliases.txt</a></p>
|
||
</aside>
|
||
<aside class="footnote brackets" id="id5" role="doc-footnote">
|
||
<span class="label"><span class="fn-bracket">[</span><a role="doc-backlink" href="#id2">2</a><span class="fn-bracket">]</span></span>
|
||
<p><a class="reference external" href="https://www.unicode.org/Public/17.0.0/ucd/NamedSequences.txt">https://www.unicode.org/Public/17.0.0/ucd/NamedSequences.txt</a></p>
|
||
</aside>
|
||
</aside>
|
||
</section>
|
||
|
||
|
||
<div class="clearer"></div>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
<div class="sphinxsidebar" role="navigation" aria-label="Main">
|
||
<div class="sphinxsidebarwrapper">
|
||
<div>
|
||
<h4>Previous topic</h4>
|
||
<p class="topless"><a href="textwrap.html"
|
||
title="previous chapter"><code class="xref py py-mod docutils literal notranslate"><span class="pre">textwrap</span></code> — Text wrapping and filling</a></p>
|
||
</div>
|
||
<div>
|
||
<h4>Next topic</h4>
|
||
<p class="topless"><a href="stringprep.html"
|
||
title="next chapter"><code class="xref py py-mod docutils literal notranslate"><span class="pre">stringprep</span></code> — Internet String Preparation</a></p>
|
||
</div>
|
||
<script>
|
||
document.addEventListener('DOMContentLoaded', () => {
|
||
const title = document.querySelector('meta[property="og:title"]').content;
|
||
const elements = document.querySelectorAll('.improvepage');
|
||
const pageurl = window.location.href.split('?')[0];
|
||
elements.forEach(element => {
|
||
const url = new URL(element.href.split('?')[0].replace("-nojs", ""));
|
||
url.searchParams.set('pagetitle', title);
|
||
url.searchParams.set('pageurl', pageurl);
|
||
url.searchParams.set('pagesource', "library/unicodedata.rst");
|
||
element.href = url.toString();
|
||
});
|
||
});
|
||
</script>
|
||
<div role="note" aria-label="source link">
|
||
<h3>This page</h3>
|
||
<ul class="this-page-menu">
|
||
<li><a href="../bugs.html">Report a bug</a></li>
|
||
<li><a class="improvepage" href="../improve-page-nojs.html">Improve this page</a></li>
|
||
<li>
|
||
<a href="https://github.com/python/cpython/blob/3.15/Doc/library/unicodedata.rst?plain=1"
|
||
rel="nofollow">Show source
|
||
</a>
|
||
</li>
|
||
|
||
</ul>
|
||
</div>
|
||
</div>
|
||
<div id="sidebarbutton" title="Collapse sidebar">
|
||
<span>«</span>
|
||
</div>
|
||
|
||
</div>
|
||
<div class="clearer"></div>
|
||
</div>
|
||
<div class="related" role="navigation" aria-label="Related">
|
||
<h3>Navigation</h3>
|
||
<ul>
|
||
<li class="right" style="margin-right: 10px">
|
||
<a href="../genindex.html" title="General Index"
|
||
>index</a></li>
|
||
<li class="right" >
|
||
<a href="../py-modindex.html" title="Python Module Index"
|
||
>modules</a> |</li>
|
||
<li class="right" >
|
||
<a href="stringprep.html" title="stringprep — Internet String Preparation"
|
||
>next</a> |</li>
|
||
<li class="right" >
|
||
<a href="textwrap.html" title="textwrap — Text wrapping and filling"
|
||
>previous</a> |</li>
|
||
|
||
<li class="root-icon"><img src="../_static/py.svg" alt="Python logo" style="vertical-align: middle; margin-top: -1px"></li>
|
||
<li><a href="https://www.python.org/">Python</a> »</li>
|
||
<li class="switchers">
|
||
<div class="language_switcher_placeholder"></div>
|
||
<div class="version_switcher_placeholder"></div>
|
||
</li>
|
||
<li>
|
||
|
||
</li>
|
||
<li id="cpython-language-and-version">
|
||
<a href="../index.html">3.15.0 Documentation</a> »
|
||
</li>
|
||
|
||
<li class="nav-item nav-item-1"><a href="index.html" >The Python standard library</a> »</li>
|
||
<li class="nav-item nav-item-2"><a href="text.html" >Text Processing Services</a> »</li>
|
||
<li class="nav-item nav-item-this"><a href=""><code class="xref py py-mod docutils literal notranslate"><span class="pre">unicodedata</span></code> — Unicode Database</a></li>
|
||
<li class="right">
|
||
|
||
|
||
<div class="inline-search" role="search">
|
||
<form class="inline-search" action="../search.html" method="get">
|
||
<input placeholder="Quick search" aria-label="Quick search" type="search" name="q" id="search-box">
|
||
<input type="submit" value="Go">
|
||
</form>
|
||
</div>
|
||
|
|
||
</li>
|
||
<li class="right">
|
||
<label class="theme-selector-label">
|
||
Theme
|
||
<select class="theme-selector" oninput="activateTheme(this.value)">
|
||
<option value="auto" selected>Auto</option>
|
||
<option value="light">Light</option>
|
||
<option value="dark">Dark</option>
|
||
</select>
|
||
</label> |</li>
|
||
|
||
</ul>
|
||
</div>
|
||
<div class="footer">
|
||
© <a href="../copyright.html">Copyright</a> 2001 Python Software Foundation.
|
||
<br>
|
||
This page is licensed under the Python Software Foundation License Version 2.
|
||
<br>
|
||
Examples, recipes, and other code in the documentation are additionally licensed under the Zero Clause BSD License.
|
||
<br>
|
||
|
||
See <a href="/license.html">History and License</a> for more information.<br>
|
||
|
||
|
||
<br>
|
||
|
||
The Python Software Foundation is a non-profit corporation.
|
||
<a href="https://www.python.org/psf/donations/">Please donate.</a>
|
||
<br>
|
||
<br>
|
||
Last updated on Oct 09, 2026 (11:35 UTC).
|
||
|
||
<a href="/bugs.html">Found a bug</a>?
|
||
|
||
<br>
|
||
|
||
Created using <a href="https://www.sphinx-doc.org/">Sphinx</a> 8.2.3.
|
||
</div>
|
||
|
||
</body>
|
||
</html> |