diff options
author | Fred Drake <fdrake@acm.org> | 2000-04-06 14:43:12 (GMT) |
---|---|---|
committer | Fred Drake <fdrake@acm.org> | 2000-04-06 14:43:12 (GMT) |
commit | 33d51841a37dee10cb6ca21683f5f2520209ea00 (patch) | |
tree | ee56da47dd7f0809a7af2d1a8dbf204d90ac6419 /Doc/lib | |
parent | f4a3bd4991ee544d2af90cf620aa0e6c97529802 (diff) | |
download | cpython-33d51841a37dee10cb6ca21683f5f2520209ea00.zip cpython-33d51841a37dee10cb6ca21683f5f2520209ea00.tar.gz cpython-33d51841a37dee10cb6ca21683f5f2520209ea00.tar.bz2 |
Marc-Andre Lemburg <mal@lemburg.com>:
Documentation for unichr(), unicode(), update for ord().
Diffstat (limited to 'Doc/lib')
-rw-r--r-- | Doc/lib/libfuncs.tex | 23 |
1 files changed, 20 insertions, 3 deletions
diff --git a/Doc/lib/libfuncs.tex b/Doc/lib/libfuncs.tex index b9c03b7..2fba45a 100644 --- a/Doc/lib/libfuncs.tex +++ b/Doc/lib/libfuncs.tex @@ -466,9 +466,11 @@ one argument, return the smallest of the arguments. \end{funcdesc} \begin{funcdesc}{ord}{c} - Return the \ASCII{} value of a string of one character. E.g., - \code{ord('a')} returns the integer \code{97}. This is the inverse of - \function{chr()}. + Return the \ASCII{} value of a string of one character or a Unicode + character. E.g., \code{ord('a')} returns the integer \code{97}, + \code{ord(u'\\u2020')} returns \code{8224}. This is the inverse of + \function{chr()} for strings and of \function{unichr()} for Unicode + characters. \end{funcdesc} \begin{funcdesc}{pow}{x, y\optional{, z}} @@ -660,6 +662,21 @@ For instance: \end{verbatim} \end{funcdesc} +\begin{funcdesc}{unichr}{i} +Return the Unicode string of one character whose Unicode code is the +integer \var{i}, e.g., \code{unichr(97)} returns the string +\code{u'a'}. This is the inverse of \function{ord()} for Unicode +strings. The argument must be in the range [0..65535], inclusive. +\exception{ValueError} is raised otherwise. +\end{funcdesc} + +\begin{funcdesc}{unicode}{string\optional{, encoding='utf-8'\optional{, errors='strict'}}} +Decodes \var{string} using the codec for \var{encoding}. Error +handling is done according to \var{errors}. The default behavior is +to decode UTF-8 in strict mode, meaning that encoding errors raise +\exception{ValueError}. +\end{funcdesc} + \begin{funcdesc}{vars}{\optional{object}} Without arguments, return a dictionary corresponding to the current local symbol table. With a module, class or class instance object as |