Python Forum
chr codes - Printable Version

+- Python Forum (https://python-forum.io)
+-- Forum: Python Coding (https://python-forum.io/forum-7.html)
+--- Forum: General Coding Help (https://python-forum.io/forum-8.html)
+--- Thread: chr codes (/thread-30116.html)



chr codes - JarredAwesome - Oct-05-2020

anyone know where I can find the code to get a superscript 2?

Thanks


RE: chr codes - bowlofred - Oct-06-2020

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⁹'



RE: chr codes - JarredAwesome - Oct-06-2020

Sorry,

I meant for the car() function


RE: chr codes - micseydel - Oct-06-2020

Output:
>>> ord('²') 178 >>> chr(178) '²'