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

Read more of this post