[Tutor] why is unichr(sys.maxunicode) blank?

Albert-Jan Roskam fomcl at yahoo.com
Fri May 17 21:23:41 CEST 2013


Hi,

I was curious what the "high" four-byte ut8 unicode characters look like. Why does the snippet below not print anything (well, it will eventually, I think, but at that point I have lost my patience already). Puh-lease tell me there are no such things as Mongolian, Chinese backspaces and other nonprintable characters. ;-)
  
# Python 2.7.3 (default, Sep 26 2012, 21:53:58) [GCC 4.7.2] on linux2
>>> import sys

>>> sys.maxunicode
1114111

>>> for i in range(sys.maxunicode, 0, -1):
    print "%s [%s: %sbytes: %s]" % (unichr(i), i, len(unichr(i).encode("utf-8")), hex(i)),
 
Regards,
Albert-Jan


~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
All right, but apart from the sanitation, the medicine, education, wine, public order, irrigation, roads, a 
fresh water system, and public health, what have the Romans ever done for us?
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/tutor/attachments/20130517/fa732fea/attachment.html>


More information about the Tutor mailing list