Created
May 9, 2021 20:36
-
-
Save ekm507/fd57b6082535d12d82433bc7083ce536 to your computer and use it in GitHub Desktop.
تبدیل اعداد انگلیسی در رشته به فارسی در پایتون
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
# نگاشت اعداد انگلیسی به فارسی | |
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)) |
استفاده کردم ممنون :)
Thanks <3
عالی بود ممنونم 🤝
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
تبدیل اعداد انگلیسی در رشته به فارسی در پایتون