This file contains 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
# نگاشت اعداد انگلیسی به فارسی | |
E2P_map = {'1' : '۱', '2' : '۲', '3' : '۳', '4' : '۴', '5' : '۵', '6' : '۶', '7' : '۷', '8' : '۸', '9' : '۹', '0' : '۰' } | |
# تبدیل اعداد انگلیسی به فارسی در رشته ورودی | |
def convert_number_to_persian(strIn : str): | |
a = map(lambda ch: E2P_map[ch] if ch in E2P_map else ch, strIn) | |
return ''.join(list(a)) |