Constants
number_np
Array containing Devanagari numeral glyphs for digits zero through nine used for Nepali number localization.
The number_np constant is an array containing the ten Devanagari numeral characters representing digits 0 through 9 in Nepali script. It provides a direct lookup table for formatting numbers, years, dates, and currency values into native Devanagari script for Nepali language interfaces.
Import
from nepali_date_library import number_npValue
number_np = ["०", "१", "२", "३", "४", "५", "६", "७", "८", "९"]Digit Lookup Table
| Index | Arabic Digit | Devanagari Numeral | Unicode Code Point |
|---|---|---|---|
0 | 0 | ० | U+0966 |
1 | 1 | १ | U+0967 |
2 | 2 | २ | U+0968 |
3 | 3 | ३ | U+0969 |
4 | 4 | ४ | U+096A |
5 | 5 | ५ | U+096B |
6 | 6 | ६ | U+096C |
7 | 7 | ७ | U+096D |
8 | 8 | ८ | U+096E |
9 | 9 | ९ | U+096F |
Examples
Converting Digits to Devanagari
from nepali_date_library import number_np
def to_devanagari(number: int) -> str:
return "".join(number_np[int(digit)] for digit in str(number))
print(to_devanagari(2081)) # "२०८१"Related
date.format(): Format dates using token specifiers with optional Devanagari numerals.month_np: Devanagari month names.
Advertisement
nepali_date_map
Historical calendar mapping table storing verified day counts for every Bikram Sambat month between 1976 and 2100 BS.
month_en
Array containing standard romanized English names of all twelve Bikram Sambat calendar months.