Search code examples
pythonhindi

How do I combine 2 letters in hindi(unicode)? (ex. क and ख)


How do I combine 2 letters such as क and ख ⟶ क्ख?

What I tried:

  • '्'.join(['क','ख']) -> 'क्‪ख'

  • print("क"+"\b"+"ख") -> 'ख' or 'क\x08ख'

  • print('क'+'्'+'ख') -> क्‪ख

  • print('क्‪ख'.replace('्',"")) -> कख

I got the answer (soln 1 worked, just had to add # -*- coding: utf-8 -*- to the top of the file)


Solution

  • (yes, i am the author of the question)

    At the top of your python file, add this: # -*- coding: utf-8 -*-

    And then soln. 1 works: print('्'.join(['क','ख'])) OR this one:

    print('न्म'[2].join(['क','ख']))