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 encoding: In [5]: import sys In [6]: sys.stdout.encoding Out[6]: 'UTF-8' In [7]: print u'\u03a7\u00b2'.encode(sys.stdout.encoding) Χ² -- Robert Kern "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 [email protected] http://projects.scipy.org/mailman/listinfo/numpy-discussion
