D
D
Danil Samodurov2021-07-30 23:11:50
Python
Danil Samodurov, 2021-07-30 23:11:50

How to display subscript character in input string?

Hello. How to implement subscript character (subscript) in python string output? The symbol does not have to be a number.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
M
Michael, 2021-07-30
@samodurOFF

Unicode indexes are supported in Python 3.x, and you can use them in your code:

  • 0x208N - for numbers, +, -, =, (, )
  • 0x209N - for letters

Usage example:
print(u'H\u2082O\u2082')
# H₂O₂

Source: Stack Overflow

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question