How to emit Cyrillic and Chinese via unicode from console mode?

pataphor pataphor at gmail.com
Sun Sep 14 09:25:28 EDT 2008


On Sun, 14 Sep 2008 01:02:39 -0700 (PDT)
rs387 <rstarkov at gmail.com> wrote:

> On Sep 14, 2:03 am, "Siegfried Heintze" <siegfr... at heintze.com> wrote:
> > Can someone point me to an example of a little program that emits
> > non-ascii Unicode characters (Russian or Chinese perhaps)?
> 
> The following doesn't quite work, but I'll post it anyway since it
> actually ends up printing the characters. 

That's more like it! Just answer with whatever one has. Here's another
gem:

from Tkinter import *
from collections import deque

def byn(x,n =5 ):
    L = deque(x)
    R = []
    while L:
        R.append(L.popleft())
        if len(R) == n:
            yield ''.join(R)
            R = []
    if R:
        yield ''.join(R)
    
root = Tk()
start = int('16A6',16)
end = int('16F0',16)
g = (unichr(i) for i in xrange(start, end+1))
L = byn(g,16)
s = '\n'.join(L)
w = Label(root, text=s,font = ("freemono","80"))
w.pack()

root.mainloop()

P.




More information about the Python-list mailing list