📄 module-unicodedata.html
字号:
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<title>4.8 unicodedata -- Unicode Database</title>
<META NAME="description" CONTENT="4.8 unicodedata -- Unicode Database">
<META NAME="keywords" CONTENT="lib">
<META NAME="resource-type" CONTENT="document">
<META NAME="distribution" CONTENT="global">
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<link rel="STYLESHEET" href="lib.css" tppabs="http://www.python.org/doc/current/lib/lib.css">
<LINK REL="previous" href="module-codecs.html" tppabs="http://www.python.org/doc/current/lib/module-codecs.html">
<LINK REL="up" href="strings.html" tppabs="http://www.python.org/doc/current/lib/strings.html">
<LINK REL="next" href="misc.html" tppabs="http://www.python.org/doc/current/lib/misc.html">
</head>
<body>
<DIV CLASS="navigation"><table align="center" width="100%" cellpadding="0" cellspacing="2">
<tr>
<td><A href="stream-recoder-objects.html" tppabs="http://www.python.org/doc/current/lib/stream-recoder-objects.html"><img src="previous.gif" tppabs="http://www.python.org/doc/current/icons/previous.gif" border="0" height="32"
alt="Previous Page" width="32"></A></td>
<td><A href="strings.html" tppabs="http://www.python.org/doc/current/lib/strings.html"><img src="up.gif" tppabs="http://www.python.org/doc/current/icons/up.gif" border="0" height="32"
alt="Up One Level" width="32"></A></td>
<td><A href="misc.html" tppabs="http://www.python.org/doc/current/lib/misc.html"><img src="next.gif" tppabs="http://www.python.org/doc/current/icons/next.gif" border="0" height="32"
alt="Next Page" width="32"></A></td>
<td align="center" width="100%">Python Library Reference</td>
<td><A href="contents.html" tppabs="http://www.python.org/doc/current/lib/contents.html"><img src="contents.gif" tppabs="http://www.python.org/doc/current/icons/contents.gif" border="0" height="32"
alt="Contents" width="32"></A></td>
<td><a href="modindex.html" tppabs="http://www.python.org/doc/current/lib/modindex.html" title="Module Index"><img src="modules.gif" tppabs="http://www.python.org/doc/current/icons/modules.gif" border="0" height="32"
alt="Module Index" width="32"></a></td>
<td><A href="genindex.html" tppabs="http://www.python.org/doc/current/lib/genindex.html"><img src="index.gif" tppabs="http://www.python.org/doc/current/icons/index.gif" border="0" height="32"
alt="Index" width="32"></A></td>
</tr></table>
<b class="navlabel">Previous:</b> <a class="sectref" href="stream-recoder-objects.html" tppabs="http://www.python.org/doc/current/lib/stream-recoder-objects.html">4.7.1.5 StreamRecoder Objects</A>
<b class="navlabel">Up:</b> <a class="sectref" href="strings.html" tppabs="http://www.python.org/doc/current/lib/strings.html">4. String Services</A>
<b class="navlabel">Next:</b> <a class="sectref" href="misc.html" tppabs="http://www.python.org/doc/current/lib/misc.html">5. Miscellaneous Services</A>
<br><hr></DIV>
<!--End of Navigation Panel-->
<H1><A NAME="SECTION006800000000000000000">
4.8 <tt class="module">unicodedata</tt> --
Unicode Database</A>
</H1>
<P>
<P>
<P>
This module provides access to the Unicode Character Database which
defines character properties for all Unicode characters. The data in
this database is based on the <span class="file">UnicodeData.txt</span> file version
3.0.0 which is publically available from <a class="url" href="javascript:if(confirm('ftp://ftp.unicode.org/ \n\nThis file was not retrieved by Teleport Pro, because it is addressed on a domain or path outside the boundaries set for its Starting Address. \n\nDo you want to open it from the server?'))window.location='ftp://ftp.unicode.org/'" tppabs="ftp://ftp.unicode.org/">ftp://ftp.unicode.org/ <img src="offsite.gif" tppabs="http://www.python.org/doc/current/icons/offsite.gif"
border='0' class='offsitelink' height='15' width='17' alt='[off-site link]'
></a>.
<P>
The module uses the same names and symbols as defined by the
UnicodeData File Format 3.0.0 (see
<a class="url" href="javascript:if(confirm('http://www.unicode.org/Public/UNIDATA/UnicodeData.html \n\nThis file was not retrieved by Teleport Pro, because it is addressed on a domain or path outside the boundaries set for its Starting Address. \n\nDo you want to open it from the server?'))window.location='http://www.unicode.org/Public/UNIDATA/UnicodeData.html'" tppabs="http://www.unicode.org/Public/UNIDATA/UnicodeData.html">http://www.unicode.org/Public/UNIDATA/UnicodeData.html <img src="offsite.gif" tppabs="http://www.python.org/doc/current/icons/offsite.gif"
border='0' class='offsitelink' height='15' width='17' alt='[off-site link]'
></a>). It
defines the following functions:
<P>
<dl><dt><b><a name='l2h-675'><tt class='function'>decimal</tt></a></b> (<var>unichr</var><big>[</big><var>, default</var><big>]</big>)
<dd>
Returns the decimal value assigned to the Unicode character
<var>unichr</var> as integer. If no such value is defined,
<var>default</var> is returned, or, if not given,
<tt class="exception">ValueError</tt> is raised.
</dl>
<P>
<dl><dt><b><a name='l2h-676'><tt class='function'>digit</tt></a></b> (<var>unichr</var><big>[</big><var>, default</var><big>]</big>)
<dd>
Returns the digit value assigned to the Unicode character
<var>unichr</var> as integer. If no such value is defined,
<var>default</var> is returned, or, if not given,
<tt class="exception">ValueError</tt> is raised.
</dl>
<P>
<dl><dt><b><a name='l2h-677'><tt class='function'>numeric</tt></a></b> (<var>unichr</var><big>[</big><var>, default</var><big>]</big>)
<dd>
Returns the numeric value assigned to the Unicode character
<var>unichr</var> as float. If no such value is defined, <var>default</var> is
returned, or, if not given, <tt class="exception">ValueError</tt> is raised.
</dl>
<P>
<dl><dt><b><a name='l2h-678'><tt class='function'>category</tt></a></b> (<var>unichr</var>)
<dd>
Returns the general category assigned to the Unicode character
<var>unichr</var> as string.
</dl>
<P>
<dl><dt><b><a name='l2h-679'><tt class='function'>bidirectional</tt></a></b> (<var>unichr</var>)
<dd>
Returns the bidirectional category assigned to the Unicode character
<var>unichr</var> as string. If no such value is defined, an empty string
is returned.
</dl>
<P>
<dl><dt><b><a name='l2h-680'><tt class='function'>combining</tt></a></b> (<var>unichr</var>)
<dd>
Returns the canonical combining class assigned to the Unicode
character <var>unichr</var> as integer. Returns <code>0</code> if no combining
class is defined.
</dl>
<P>
<dl><dt><b><a name='l2h-681'><tt class='function'>mirrored</tt></a></b> (<var>unichr</var>)
<dd>
Returns the mirrored property of assigned to the Unicode character
<var>unichr</var> as integer. Returns <code>1</code> if the character has been
identified as a ``mirrored'' character in bidirectional text,
<code>0</code> otherwise.
</dl>
<P>
<dl><dt><b><a name='l2h-682'><tt class='function'>decomposition</tt></a></b> (<var>unichr</var>)
<dd>
Returns the character decomposition mapping assigned to the Unicode
character <var>unichr</var> as string. An empty string is returned in case
no such mapping is defined.
</dl>
<P>
<DIV CLASS="navigation"><p><hr><table align="center" width="100%" cellpadding="0" cellspacing="2">
<tr>
<td><A href="stream-recoder-objects.html" tppabs="http://www.python.org/doc/current/lib/stream-recoder-objects.html"><img src="previous.gif" tppabs="http://www.python.org/doc/current/icons/previous.gif" border="0" height="32"
alt="Previous Page" width="32"></A></td>
<td><A href="strings.html" tppabs="http://www.python.org/doc/current/lib/strings.html"><img src="up.gif" tppabs="http://www.python.org/doc/current/icons/up.gif" border="0" height="32"
alt="Up One Level" width="32"></A></td>
<td><A href="misc.html" tppabs="http://www.python.org/doc/current/lib/misc.html"><img src="next.gif" tppabs="http://www.python.org/doc/current/icons/next.gif" border="0" height="32"
alt="Next Page" width="32"></A></td>
<td align="center" width="100%">Python Library Reference</td>
<td><A href="contents.html" tppabs="http://www.python.org/doc/current/lib/contents.html"><img src="contents.gif" tppabs="http://www.python.org/doc/current/icons/contents.gif" border="0" height="32"
alt="Contents" width="32"></A></td>
<td><a href="modindex.html" tppabs="http://www.python.org/doc/current/lib/modindex.html" title="Module Index"><img src="modules.gif" tppabs="http://www.python.org/doc/current/icons/modules.gif" border="0" height="32"
alt="Module Index" width="32"></a></td>
<td><A href="genindex.html" tppabs="http://www.python.org/doc/current/lib/genindex.html"><img src="index.gif" tppabs="http://www.python.org/doc/current/icons/index.gif" border="0" height="32"
alt="Index" width="32"></A></td>
</tr></table>
<b class="navlabel">Previous:</b> <a class="sectref" href="stream-recoder-objects.html" tppabs="http://www.python.org/doc/current/lib/stream-recoder-objects.html">4.7.1.5 StreamRecoder Objects</A>
<b class="navlabel">Up:</b> <a class="sectref" href="strings.html" tppabs="http://www.python.org/doc/current/lib/strings.html">4. String Services</A>
<b class="navlabel">Next:</b> <a class="sectref" href="misc.html" tppabs="http://www.python.org/doc/current/lib/misc.html">5. Miscellaneous Services</A>
</DIV>
<!--End of Navigation Panel-->
<ADDRESS>
<hr>See <i><a href="about.html" tppabs="http://www.python.org/doc/current/lib/about.html">About this document...</a></i> for information on suggesting changes.
</ADDRESS>
</BODY>
</HTML>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -