gooderp18绿色标准版
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

486 lines
30KB

  1. <!DOCTYPE html>
  2. <html lang="en" data-content_root="../">
  3. <head>
  4. <meta charset="utf-8" />
  5. <meta name="viewport" content="width=device-width, initial-scale=1.0" /><meta name="viewport" content="width=device-width, initial-scale=1" />
  6. <meta property="og:title" content="unicodedata — Unicode Database" />
  7. <meta property="og:type" content="website" />
  8. <meta property="og:url" content="https://docs.python.org/3/library/unicodedata.html" />
  9. <meta property="og:site_name" content="Python documentation" />
  10. <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..." />
  11. <meta property="og:image" content="https://docs.python.org/3/_static/og-image.png" />
  12. <meta property="og:image:alt" content="Python documentation" />
  13. <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..." />
  14. <meta property="og:image:width" content="200" />
  15. <meta property="og:image:height" content="200" />
  16. <meta name="theme-color" content="#3776ab" />
  17. <title>unicodedata — Unicode Database &#8212; Python 3.12.3 documentation</title><meta name="viewport" content="width=device-width, initial-scale=1.0">
  18. <link rel="stylesheet" type="text/css" href="../_static/pygments.css?v=80d5e7a1" />
  19. <link rel="stylesheet" type="text/css" href="../_static/pydoctheme.css?v=bb723527" />
  20. <link id="pygments_dark_css" media="(prefers-color-scheme: dark)" rel="stylesheet" type="text/css" href="../_static/pygments_dark.css?v=b20cc3f5" />
  21. <script src="../_static/documentation_options.js?v=2c828074"></script>
  22. <script src="../_static/doctools.js?v=888ff710"></script>
  23. <script src="../_static/sphinx_highlight.js?v=dc90522c"></script>
  24. <script src="../_static/sidebar.js"></script>
  25. <link rel="search" type="application/opensearchdescription+xml"
  26. title="Search within Python 3.12.3 documentation"
  27. href="../_static/opensearch.xml"/>
  28. <link rel="author" title="About these documents" href="../about.html" />
  29. <link rel="index" title="Index" href="../genindex.html" />
  30. <link rel="search" title="Search" href="../search.html" />
  31. <link rel="copyright" title="Copyright" href="../copyright.html" />
  32. <link rel="next" title="stringprep — Internet String Preparation" href="stringprep.html" />
  33. <link rel="prev" title="textwrap — Text wrapping and filling" href="textwrap.html" />
  34. <link rel="canonical" href="https://docs.python.org/3/library/unicodedata.html" />
  35. <style>
  36. @media only screen {
  37. table.full-width-table {
  38. width: 100%;
  39. }
  40. }
  41. </style>
  42. <link rel="stylesheet" href="../_static/pydoctheme_dark.css" media="(prefers-color-scheme: dark)" id="pydoctheme_dark_css">
  43. <link rel="shortcut icon" type="image/png" href="../_static/py.svg" />
  44. <script type="text/javascript" src="../_static/copybutton.js"></script>
  45. <script type="text/javascript" src="../_static/menu.js"></script>
  46. <script type="text/javascript" src="../_static/search-focus.js"></script>
  47. <script type="text/javascript" src="../_static/themetoggle.js"></script>
  48. </head>
  49. <body>
  50. <div class="mobile-nav">
  51. <input type="checkbox" id="menuToggler" class="toggler__input" aria-controls="navigation"
  52. aria-pressed="false" aria-expanded="false" role="button" aria-label="Menu" />
  53. <nav class="nav-content" role="navigation">
  54. <label for="menuToggler" class="toggler__label">
  55. <span></span>
  56. </label>
  57. <span class="nav-items-wrapper">
  58. <a href="https://www.python.org/" class="nav-logo">
  59. <img src="../_static/py.svg" alt="Python logo"/>
  60. </a>
  61. <span class="version_switcher_placeholder"></span>
  62. <form role="search" class="search" action="../search.html" method="get">
  63. <svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" class="search-icon">
  64. <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>
  65. </svg>
  66. <input placeholder="Quick search" aria-label="Quick search" type="search" name="q" />
  67. <input type="submit" value="Go"/>
  68. </form>
  69. </span>
  70. </nav>
  71. <div class="menu-wrapper">
  72. <nav class="menu" role="navigation" aria-label="main navigation">
  73. <div class="language_switcher_placeholder"></div>
  74. <label class="theme-selector-label">
  75. Theme
  76. <select class="theme-selector" oninput="activateTheme(this.value)">
  77. <option value="auto" selected>Auto</option>
  78. <option value="light">Light</option>
  79. <option value="dark">Dark</option>
  80. </select>
  81. </label>
  82. <div>
  83. <h4>Previous topic</h4>
  84. <p class="topless"><a href="textwrap.html"
  85. title="previous chapter"><code class="xref py py-mod docutils literal notranslate"><span class="pre">textwrap</span></code> — Text wrapping and filling</a></p>
  86. </div>
  87. <div>
  88. <h4>Next topic</h4>
  89. <p class="topless"><a href="stringprep.html"
  90. title="next chapter"><code class="xref py py-mod docutils literal notranslate"><span class="pre">stringprep</span></code> — Internet String Preparation</a></p>
  91. </div>
  92. <div role="note" aria-label="source link">
  93. <h3>This Page</h3>
  94. <ul class="this-page-menu">
  95. <li><a href="../bugs.html">Report a Bug</a></li>
  96. <li>
  97. <a href="https://github.com/python/cpython/blob/main/Doc/library/unicodedata.rst"
  98. rel="nofollow">Show Source
  99. </a>
  100. </li>
  101. </ul>
  102. </div>
  103. </nav>
  104. </div>
  105. </div>
  106. <div class="related" role="navigation" aria-label="related navigation">
  107. <h3>Navigation</h3>
  108. <ul>
  109. <li class="right" style="margin-right: 10px">
  110. <a href="../genindex.html" title="General Index"
  111. accesskey="I">index</a></li>
  112. <li class="right" >
  113. <a href="../py-modindex.html" title="Python Module Index"
  114. >modules</a> |</li>
  115. <li class="right" >
  116. <a href="stringprep.html" title="stringprep — Internet String Preparation"
  117. accesskey="N">next</a> |</li>
  118. <li class="right" >
  119. <a href="textwrap.html" title="textwrap — Text wrapping and filling"
  120. accesskey="P">previous</a> |</li>
  121. <li><img src="../_static/py.svg" alt="Python logo" style="vertical-align: middle; margin-top: -1px"/></li>
  122. <li><a href="https://www.python.org/">Python</a> &#187;</li>
  123. <li class="switchers">
  124. <div class="language_switcher_placeholder"></div>
  125. <div class="version_switcher_placeholder"></div>
  126. </li>
  127. <li>
  128. </li>
  129. <li id="cpython-language-and-version">
  130. <a href="../index.html">3.12.3 Documentation</a> &#187;
  131. </li>
  132. <li class="nav-item nav-item-1"><a href="index.html" >The Python Standard Library</a> &#187;</li>
  133. <li class="nav-item nav-item-2"><a href="text.html" accesskey="U">Text Processing Services</a> &#187;</li>
  134. <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>
  135. <li class="right">
  136. <div class="inline-search" role="search">
  137. <form class="inline-search" action="../search.html" method="get">
  138. <input placeholder="Quick search" aria-label="Quick search" type="search" name="q" id="search-box" />
  139. <input type="submit" value="Go" />
  140. </form>
  141. </div>
  142. |
  143. </li>
  144. <li class="right">
  145. <label class="theme-selector-label">
  146. Theme
  147. <select class="theme-selector" oninput="activateTheme(this.value)">
  148. <option value="auto" selected>Auto</option>
  149. <option value="light">Light</option>
  150. <option value="dark">Dark</option>
  151. </select>
  152. </label> |</li>
  153. </ul>
  154. </div>
  155. <div class="document">
  156. <div class="documentwrapper">
  157. <div class="bodywrapper">
  158. <div class="body" role="main">
  159. <section id="module-unicodedata">
  160. <span id="unicodedata-unicode-database"></span><h1><a class="reference internal" href="#module-unicodedata" title="unicodedata: Access the Unicode Database."><code class="xref py py-mod docutils literal notranslate"><span class="pre">unicodedata</span></code></a> — Unicode Database<a class="headerlink" href="#module-unicodedata" title="Link to this heading">¶</a></h1>
  161. <hr class="docutils" id="index-0" />
  162. <p>This module provides access to the Unicode Character Database (UCD) which
  163. defines character properties for all Unicode characters. The data contained in
  164. this database is compiled from the <a class="reference external" href="https://www.unicode.org/Public/15.0.0/ucd">UCD version 15.0.0</a>.</p>
  165. <p>The module uses the same names and symbols as defined by Unicode
  166. Standard Annex #44, <a class="reference external" href="https://www.unicode.org/reports/tr44/">“Unicode Character Database”</a>. It defines the
  167. following functions:</p>
  168. <dl class="py function">
  169. <dt class="sig sig-object py" id="unicodedata.lookup">
  170. <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><span class="sig-paren">)</span><a class="headerlink" href="#unicodedata.lookup" title="Link to this definition">¶</a></dt>
  171. <dd><p>Look up character by name. If a character with the given name is found, return
  172. the corresponding character. If not found, <a class="reference internal" href="exceptions.html#KeyError" title="KeyError"><code class="xref py py-exc docutils literal notranslate"><span class="pre">KeyError</span></code></a> is raised.</p>
  173. <div class="versionchanged">
  174. <p><span class="versionmodified changed">Changed in version 3.3: </span>Support for name aliases <a class="footnote-reference brackets" href="#id3" 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="#id4" id="id2" role="doc-noteref"><span class="fn-bracket">[</span>2<span class="fn-bracket">]</span></a> has been added.</p>
  175. </div>
  176. </dd></dl>
  177. <dl class="py function">
  178. <dt class="sig sig-object py" id="unicodedata.name">
  179. <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><span class="optional">[</span>, <em class="sig-param"><span class="n"><span class="pre">default</span></span></em><span class="optional">]</span><span class="sig-paren">)</span><a class="headerlink" href="#unicodedata.name" title="Link to this definition">¶</a></dt>
  180. <dd><p>Returns the name assigned to the character <em>chr</em> as a string. If no
  181. name is defined, <em>default</em> is returned, or, if not given, <a class="reference internal" href="exceptions.html#ValueError" title="ValueError"><code class="xref py py-exc docutils literal notranslate"><span class="pre">ValueError</span></code></a> is
  182. raised.</p>
  183. </dd></dl>
  184. <dl class="py function">
  185. <dt class="sig sig-object py" id="unicodedata.decimal">
  186. <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><span class="optional">[</span>, <em class="sig-param"><span class="n"><span class="pre">default</span></span></em><span class="optional">]</span><span class="sig-paren">)</span><a class="headerlink" href="#unicodedata.decimal" title="Link to this definition">¶</a></dt>
  187. <dd><p>Returns the decimal value assigned to the character <em>chr</em> as integer.
  188. If no such value is defined, <em>default</em> is returned, or, if not given,
  189. <a class="reference internal" href="exceptions.html#ValueError" title="ValueError"><code class="xref py py-exc docutils literal notranslate"><span class="pre">ValueError</span></code></a> is raised.</p>
  190. </dd></dl>
  191. <dl class="py function">
  192. <dt class="sig sig-object py" id="unicodedata.digit">
  193. <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><span class="optional">[</span>, <em class="sig-param"><span class="n"><span class="pre">default</span></span></em><span class="optional">]</span><span class="sig-paren">)</span><a class="headerlink" href="#unicodedata.digit" title="Link to this definition">¶</a></dt>
  194. <dd><p>Returns the digit value assigned to the character <em>chr</em> as integer.
  195. If no such value is defined, <em>default</em> is returned, or, if not given,
  196. <a class="reference internal" href="exceptions.html#ValueError" title="ValueError"><code class="xref py py-exc docutils literal notranslate"><span class="pre">ValueError</span></code></a> is raised.</p>
  197. </dd></dl>
  198. <dl class="py function">
  199. <dt class="sig sig-object py" id="unicodedata.numeric">
  200. <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><span class="optional">[</span>, <em class="sig-param"><span class="n"><span class="pre">default</span></span></em><span class="optional">]</span><span class="sig-paren">)</span><a class="headerlink" href="#unicodedata.numeric" title="Link to this definition">¶</a></dt>
  201. <dd><p>Returns the numeric value assigned to the character <em>chr</em> as float.
  202. If no such value is defined, <em>default</em> is returned, or, if not given,
  203. <a class="reference internal" href="exceptions.html#ValueError" title="ValueError"><code class="xref py py-exc docutils literal notranslate"><span class="pre">ValueError</span></code></a> is raised.</p>
  204. </dd></dl>
  205. <dl class="py function">
  206. <dt class="sig sig-object py" id="unicodedata.category">
  207. <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><span class="sig-paren">)</span><a class="headerlink" href="#unicodedata.category" title="Link to this definition">¶</a></dt>
  208. <dd><p>Returns the general category assigned to the character <em>chr</em> as
  209. string.</p>
  210. </dd></dl>
  211. <dl class="py function">
  212. <dt class="sig sig-object py" id="unicodedata.bidirectional">
  213. <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><span class="sig-paren">)</span><a class="headerlink" href="#unicodedata.bidirectional" title="Link to this definition">¶</a></dt>
  214. <dd><p>Returns the bidirectional class assigned to the character <em>chr</em> as
  215. string. If no such value is defined, an empty string is returned.</p>
  216. </dd></dl>
  217. <dl class="py function">
  218. <dt class="sig sig-object py" id="unicodedata.combining">
  219. <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><span class="sig-paren">)</span><a class="headerlink" href="#unicodedata.combining" title="Link to this definition">¶</a></dt>
  220. <dd><p>Returns the canonical combining class assigned to the character <em>chr</em>
  221. as integer. Returns <code class="docutils literal notranslate"><span class="pre">0</span></code> if no combining class is defined.</p>
  222. </dd></dl>
  223. <dl class="py function">
  224. <dt class="sig sig-object py" id="unicodedata.east_asian_width">
  225. <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><span class="sig-paren">)</span><a class="headerlink" href="#unicodedata.east_asian_width" title="Link to this definition">¶</a></dt>
  226. <dd><p>Returns the east asian width assigned to the character <em>chr</em> as
  227. string.</p>
  228. </dd></dl>
  229. <dl class="py function">
  230. <dt class="sig sig-object py" id="unicodedata.mirrored">
  231. <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><span class="sig-paren">)</span><a class="headerlink" href="#unicodedata.mirrored" title="Link to this definition">¶</a></dt>
  232. <dd><p>Returns the mirrored property assigned to the character <em>chr</em> as
  233. integer. Returns <code class="docutils literal notranslate"><span class="pre">1</span></code> if the character has been identified as a “mirrored”
  234. character in bidirectional text, <code class="docutils literal notranslate"><span class="pre">0</span></code> otherwise.</p>
  235. </dd></dl>
  236. <dl class="py function">
  237. <dt class="sig sig-object py" id="unicodedata.decomposition">
  238. <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><span class="sig-paren">)</span><a class="headerlink" href="#unicodedata.decomposition" title="Link to this definition">¶</a></dt>
  239. <dd><p>Returns the character decomposition mapping assigned to the character
  240. <em>chr</em> as string. An empty string is returned in case no such mapping is
  241. defined.</p>
  242. </dd></dl>
  243. <dl class="py function">
  244. <dt class="sig sig-object py" id="unicodedata.normalize">
  245. <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><span class="sig-paren">)</span><a class="headerlink" href="#unicodedata.normalize" title="Link to this definition">¶</a></dt>
  246. <dd><p>Return the normal form <em>form</em> for the Unicode string <em>unistr</em>. Valid values for
  247. <em>form</em> are ‘NFC’, ‘NFKC’, ‘NFD’, and ‘NFKD’.</p>
  248. <p>The Unicode standard defines various normalization forms of a Unicode string,
  249. based on the definition of canonical equivalence and compatibility equivalence.
  250. In Unicode, several characters can be expressed in various way. For example, the
  251. character U+00C7 (LATIN CAPITAL LETTER C WITH CEDILLA) can also be expressed as
  252. the sequence U+0043 (LATIN CAPITAL LETTER C) U+0327 (COMBINING CEDILLA).</p>
  253. <p>For each character, there are two normal forms: normal form C and normal form D.
  254. Normal form D (NFD) is also known as canonical decomposition, and translates
  255. each character into its decomposed form. Normal form C (NFC) first applies a
  256. canonical decomposition, then composes pre-combined characters again.</p>
  257. <p>In addition to these two forms, there are two additional normal forms based on
  258. compatibility equivalence. In Unicode, certain characters are supported which
  259. normally would be unified with other characters. For example, U+2160 (ROMAN
  260. NUMERAL ONE) is really the same thing as U+0049 (LATIN CAPITAL LETTER I).
  261. However, it is supported in Unicode for compatibility with existing character
  262. sets (e.g. gb2312).</p>
  263. <p>The normal form KD (NFKD) will apply the compatibility decomposition, i.e.
  264. replace all compatibility characters with their equivalents. The normal form KC
  265. (NFKC) first applies the compatibility decomposition, followed by the canonical
  266. composition.</p>
  267. <p>Even if two unicode strings are normalized and look the same to
  268. a human reader, if one has combining characters and the other
  269. doesn’t, they may not compare equal.</p>
  270. </dd></dl>
  271. <dl class="py function">
  272. <dt class="sig sig-object py" id="unicodedata.is_normalized">
  273. <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><span class="sig-paren">)</span><a class="headerlink" href="#unicodedata.is_normalized" title="Link to this definition">¶</a></dt>
  274. <dd><p>Return whether the Unicode string <em>unistr</em> is in the normal form <em>form</em>. Valid
  275. values for <em>form</em> are ‘NFC’, ‘NFKC’, ‘NFD’, and ‘NFKD’.</p>
  276. <div class="versionadded">
  277. <p><span class="versionmodified added">New in version 3.8.</span></p>
  278. </div>
  279. </dd></dl>
  280. <p>In addition, the module exposes the following constant:</p>
  281. <dl class="py data">
  282. <dt class="sig sig-object py" id="unicodedata.unidata_version">
  283. <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>
  284. <dd><p>The version of the Unicode database used in this module.</p>
  285. </dd></dl>
  286. <dl class="py data">
  287. <dt class="sig sig-object py" id="unicodedata.ucd_3_2_0">
  288. <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>
  289. <dd><p>This is an object that has the same methods as the entire module, but uses the
  290. Unicode database version 3.2 instead, for applications that require this
  291. specific version of the Unicode database (such as IDNA).</p>
  292. </dd></dl>
  293. <p>Examples:</p>
  294. <div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="kn">import</span> <span class="nn">unicodedata</span>
  295. <span class="gp">&gt;&gt;&gt; </span><span class="n">unicodedata</span><span class="o">.</span><span class="n">lookup</span><span class="p">(</span><span class="s1">&#39;LEFT CURLY BRACKET&#39;</span><span class="p">)</span>
  296. <span class="go">&#39;{&#39;</span>
  297. <span class="gp">&gt;&gt;&gt; </span><span class="n">unicodedata</span><span class="o">.</span><span class="n">name</span><span class="p">(</span><span class="s1">&#39;/&#39;</span><span class="p">)</span>
  298. <span class="go">&#39;SOLIDUS&#39;</span>
  299. <span class="gp">&gt;&gt;&gt; </span><span class="n">unicodedata</span><span class="o">.</span><span class="n">decimal</span><span class="p">(</span><span class="s1">&#39;9&#39;</span><span class="p">)</span>
  300. <span class="go">9</span>
  301. <span class="gp">&gt;&gt;&gt; </span><span class="n">unicodedata</span><span class="o">.</span><span class="n">decimal</span><span class="p">(</span><span class="s1">&#39;a&#39;</span><span class="p">)</span>
  302. <span class="gt">Traceback (most recent call last):</span>
  303. File <span class="nb">&quot;&lt;stdin&gt;&quot;</span>, line <span class="m">1</span>, in <span class="n">&lt;module&gt;</span>
  304. <span class="gr">ValueError</span>: <span class="n">not a decimal</span>
  305. <span class="gp">&gt;&gt;&gt; </span><span class="n">unicodedata</span><span class="o">.</span><span class="n">category</span><span class="p">(</span><span class="s1">&#39;A&#39;</span><span class="p">)</span> <span class="c1"># &#39;L&#39;etter, &#39;u&#39;ppercase</span>
  306. <span class="go">&#39;Lu&#39;</span>
  307. <span class="gp">&gt;&gt;&gt; </span><span class="n">unicodedata</span><span class="o">.</span><span class="n">bidirectional</span><span class="p">(</span><span class="s1">&#39;</span><span class="se">\u0660</span><span class="s1">&#39;</span><span class="p">)</span> <span class="c1"># &#39;A&#39;rabic, &#39;N&#39;umber</span>
  308. <span class="go">&#39;AN&#39;</span>
  309. </pre></div>
  310. </div>
  311. <p class="rubric">Footnotes</p>
  312. <aside class="footnote-list brackets">
  313. <aside class="footnote brackets" id="id3" role="doc-footnote">
  314. <span class="label"><span class="fn-bracket">[</span><a role="doc-backlink" href="#id1">1</a><span class="fn-bracket">]</span></span>
  315. <p><a class="reference external" href="https://www.unicode.org/Public/15.0.0/ucd/NameAliases.txt">https://www.unicode.org/Public/15.0.0/ucd/NameAliases.txt</a></p>
  316. </aside>
  317. <aside class="footnote brackets" id="id4" role="doc-footnote">
  318. <span class="label"><span class="fn-bracket">[</span><a role="doc-backlink" href="#id2">2</a><span class="fn-bracket">]</span></span>
  319. <p><a class="reference external" href="https://www.unicode.org/Public/15.0.0/ucd/NamedSequences.txt">https://www.unicode.org/Public/15.0.0/ucd/NamedSequences.txt</a></p>
  320. </aside>
  321. </aside>
  322. </section>
  323. <div class="clearer"></div>
  324. </div>
  325. </div>
  326. </div>
  327. <div class="sphinxsidebar" role="navigation" aria-label="main navigation">
  328. <div class="sphinxsidebarwrapper">
  329. <div>
  330. <h4>Previous topic</h4>
  331. <p class="topless"><a href="textwrap.html"
  332. title="previous chapter"><code class="xref py py-mod docutils literal notranslate"><span class="pre">textwrap</span></code> — Text wrapping and filling</a></p>
  333. </div>
  334. <div>
  335. <h4>Next topic</h4>
  336. <p class="topless"><a href="stringprep.html"
  337. title="next chapter"><code class="xref py py-mod docutils literal notranslate"><span class="pre">stringprep</span></code> — Internet String Preparation</a></p>
  338. </div>
  339. <div role="note" aria-label="source link">
  340. <h3>This Page</h3>
  341. <ul class="this-page-menu">
  342. <li><a href="../bugs.html">Report a Bug</a></li>
  343. <li>
  344. <a href="https://github.com/python/cpython/blob/main/Doc/library/unicodedata.rst"
  345. rel="nofollow">Show Source
  346. </a>
  347. </li>
  348. </ul>
  349. </div>
  350. </div>
  351. <div id="sidebarbutton" title="Collapse sidebar">
  352. <span>«</span>
  353. </div>
  354. </div>
  355. <div class="clearer"></div>
  356. </div>
  357. <div class="related" role="navigation" aria-label="related navigation">
  358. <h3>Navigation</h3>
  359. <ul>
  360. <li class="right" style="margin-right: 10px">
  361. <a href="../genindex.html" title="General Index"
  362. >index</a></li>
  363. <li class="right" >
  364. <a href="../py-modindex.html" title="Python Module Index"
  365. >modules</a> |</li>
  366. <li class="right" >
  367. <a href="stringprep.html" title="stringprep — Internet String Preparation"
  368. >next</a> |</li>
  369. <li class="right" >
  370. <a href="textwrap.html" title="textwrap — Text wrapping and filling"
  371. >previous</a> |</li>
  372. <li><img src="../_static/py.svg" alt="Python logo" style="vertical-align: middle; margin-top: -1px"/></li>
  373. <li><a href="https://www.python.org/">Python</a> &#187;</li>
  374. <li class="switchers">
  375. <div class="language_switcher_placeholder"></div>
  376. <div class="version_switcher_placeholder"></div>
  377. </li>
  378. <li>
  379. </li>
  380. <li id="cpython-language-and-version">
  381. <a href="../index.html">3.12.3 Documentation</a> &#187;
  382. </li>
  383. <li class="nav-item nav-item-1"><a href="index.html" >The Python Standard Library</a> &#187;</li>
  384. <li class="nav-item nav-item-2"><a href="text.html" >Text Processing Services</a> &#187;</li>
  385. <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>
  386. <li class="right">
  387. <div class="inline-search" role="search">
  388. <form class="inline-search" action="../search.html" method="get">
  389. <input placeholder="Quick search" aria-label="Quick search" type="search" name="q" id="search-box" />
  390. <input type="submit" value="Go" />
  391. </form>
  392. </div>
  393. |
  394. </li>
  395. <li class="right">
  396. <label class="theme-selector-label">
  397. Theme
  398. <select class="theme-selector" oninput="activateTheme(this.value)">
  399. <option value="auto" selected>Auto</option>
  400. <option value="light">Light</option>
  401. <option value="dark">Dark</option>
  402. </select>
  403. </label> |</li>
  404. </ul>
  405. </div>
  406. <div class="footer">
  407. &copy;
  408. <a href="../copyright.html">
  409. Copyright
  410. </a>
  411. 2001-2024, Python Software Foundation.
  412. <br />
  413. This page is licensed under the Python Software Foundation License Version 2.
  414. <br />
  415. Examples, recipes, and other code in the documentation are additionally licensed under the Zero Clause BSD License.
  416. <br />
  417. See <a href="/license.html">History and License</a> for more information.<br />
  418. <br />
  419. The Python Software Foundation is a non-profit corporation.
  420. <a href="https://www.python.org/psf/donations/">Please donate.</a>
  421. <br />
  422. <br />
  423. Last updated on Apr 09, 2024 (13:47 UTC).
  424. <a href="/bugs.html">Found a bug</a>?
  425. <br />
  426. Created using <a href="https://www.sphinx-doc.org/">Sphinx</a> 7.2.6.
  427. </div>
  428. </body>
  429. </html>
上海开阖软件有限公司 沪ICP备12045867号-1