[Numpy-discussion] Greek Letters
Tue Feb 20 19:16:23 CST 2007
Thanks Robert.... but alas, I get.....
>>> import sys
>>> print u'\u03a7\u00b2'.encode(sys.stdout.encoding)
Traceback (most recent call last):
File "<stdin>", line 1, in ?
File "C:\Python24\lib\encodings\cp437.py", line 18, in encode
UnicodeEncodeError: 'charmap' codec can't encode character u'\u03a7' in position
0: character maps to <undefined>
Ill keep at it.... please let me know if you have any solutions....
From: firstname.lastname@example.org [mailto:email@example.com] On Behalf Of Robert Kern
Sent: Tuesday, February 20, 2007 4:20 PM
To: Discussion of Numerical Python
Subject: Re: [Numpy-discussion] Greek Letters
Mark Janikas wrote:
> Hello all,
> I was wondering how I could print the chi-squared symbol in python. I
> have been looking at the Unicode docs, but I figured I would ask for
> assistance here while I delve into it. Thanks for any help in advance.
Print it where? To the terminal (which one?)? In HTML? With some GUI?
Assuming that you have a Unicode-capable terminal, you can find out the encoding
it uses by looking at sys.stdout.encoding. Encode your Unicode string with that
encoding, and print it. E.g., I use iTerm on OS X and set it to use UTF-8 as the
In : import sys
In : sys.stdout.encoding
In : print u'\u03a7\u00b2'.encode(sys.stdout.encoding)
"I have come to believe that the whole world is an enigma, a harmless enigma
that is made terrible by our own mad attempt to interpret it as though it had
an underlying truth."
-- Umberto Eco
Numpy-discussion mailing list
More information about the Numpy-discussion