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. :(

Here:

print u'\u2070\xb9\xb2\xb3\u2074\u2075\u2076\u2077\u2078\u2079'

If you want to display the result you have to use a GUI toolkit like PyQt. The PyQt label widget can display html formatted text like this example shows:
http://www.daniweb.com/forums/post1093216.html#post1093216

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

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!!!!

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.