1# function to convert to subscript
2def get_sub(x):
3 normal = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+-=()"
4 sub_s = "ₐ₈CDₑբGₕᵢⱼₖₗₘₙₒₚQᵣₛₜᵤᵥwₓᵧZₐ♭꜀ᑯₑբ₉ₕᵢⱼₖₗₘₙₒₚ૧ᵣₛₜᵤᵥwₓᵧ₂₀₁₂₃₄₅₆₇₈₉₊₋₌₍₎"
5 res = x.maketrans(''.join(normal), ''.join(sub_s))
6 return x.translate(res)
7
8# display subscript
9print('H{}SO{}'.format(get_sub('2'),get_sub('4'))) #H₂SO₄
10