Hello ! Recently I was doing some text formatting using python and this forum was extremely handy. My problem now is to put any letter in subscript or superscript. Apparently in Unicode there are just a few symbols in superscript but I want to put let say letter "b" in superscript. How I can do this ?
thanks beforehand

I think it would be more useful to specify where this text is. If you are working with HTML it would be very different, say, from text in a gui app.

I just want to print this text or export it into a file
for example :

letter = x(superscript a)
print letter

As Namibnat has already stated, it depends on what you are using to print it. Obviously, if you are printing in the terminal you are limited to ASCII characters and can not do it, as you stated yourself, so you will have to be more specific than just stating that you want to print it, as each printing mechanism has it's own, different way of displaying text. So far, you are just wasting everyone's time.

I need any simple way to do a same thing (like code bellow) but with any symbols!

w =  u'\u03B1 (deg)'
s =  'x 'u'\u0363 +y \u0364 +z \u0365'
print "w is: ", w
print "s is: ", s

Program in python which would return this "x 'u'\u0363" in python shell. This is all what I want. :(

Thanks Allot very helpful ! Is there are way to do a same thing but with tkinter? Sorry, I want to much probably !

To my knowledge Tkinter has no widget that interprets html code. However wxPython has a wx.html.HtmlWindow() that works similarly.

To my knowledge Tkinter has no widget that interprets html code. However wxPython has a wx.html.HtmlWindow() that works similarly.

Thanks for help highly appreciated!!!!

This article has been dead for over six months. Start a new discussion instead.