Files
sakhteman/core/utils/number.py
T

13 lines
441 B
Python
Raw Normal View History

2024-02-15 00:17:51 +03:30
import re
E2P_map = {'1': '۱', '2': '۲', '3': '۳', '4': '۴', '5': '۵', '6': '۶', '7': '۷', '8': '۸', '9': '۹', '0': '۰'}
E2P_map = {'1': '۱', '2': '۲', '3': '۳', '4': '۴', '5': '۵', '6': '۶', '7': '۷', '8': '۸', '9': '۹', '0': '۰'}
# convert persian number to english number
def convert_number_to_persian(str_in: str):
a = map(lambda ch: E2P_map[ch] if ch in E2P_map else ch, str_in)
return ''.join(list(a))