Skip to content

Instantly share code, notes, and snippets.

@answerquest
Created May 13, 2019 04:30
Show Gist options
  • Select an option

  • Save answerquest/efbd5fe181669b9f34114d23b509fe8a to your computer and use it in GitHub Desktop.

Select an option

Save answerquest/efbd5fe181669b9f34114d23b509fe8a to your computer and use it in GitHub Desktop.
Python function to convert a number (digits) to unicode devnagri (hindi/marathi/other) equvalent. Preserves all non-numeric characters like decimal
def devnagriNum(n):
devn = ''
for i in list(str(n)):
if i.isdigit():
devn += (chr(2406+int(i) ) )
else: devn += i
return devn
# test:
print(devnagriNum(345)) # ३४५
print(devnagriNum(34.76)) # ३४.७६
@Panday-G-22-G
Copy link

1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment