Python Forum

Full Version: chr codes
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
anyone know where I can find the code to get a superscript 2?

Thanks
Is this for a terminal? HTML? Something else?

For character output, you could try using the codes in wikipedia and seeing if they render properly. In my terminal, 1, 2, and 3 are dissimilar to higher powers.

>>> 'X\u00B2 X\u00B3 X\u2074 X\u2075 X\u2079'
'X² X³ X⁴ X⁵ X⁹'
Sorry,

I meant for the car() function
Output:
>>> ord('²') 178 >>> chr(178) '²'