-   Programming (
-   -   python: using a variable to print unicode character (

donnied 02-02-2008 12:08 AM

python: using a variable to print unicode character
I'd like to do something like:
g = 0000
while g < ffff
g = g+0001
print u'\u\g'
The question is: (how) can I have python evaluate the variable g and print the corresponding unicode character?

traene 02-03-2008 02:06 PM

I haven't tried that, but maybe the unicode package will help:


angrybanana 02-04-2008 12:31 AM


start = '0000'
stop  = 'ffff'

for i in range(int(start, 16), int(stop, 16)):
    print unichr(i)

donnied 02-09-2008 03:51 AM

excellent suggestion
Thank you. That really simplified the code. I won't say what I had done before, but your response was similar to a shell script I had used to create the data files used to create individual classes. doh.

Now, I will work on two more aspects:
directing the output to a formatted window using glade
providing a way to select/import fonts

All times are GMT -5. The time now is 12:02 PM.