Created
May 13, 2019 04:30
-
-
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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)) # ३४.७६ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
1