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)) |
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
# Tested on Python 3.6.1 | |
# install: pip install --upgrade arabic-reshaper | |
import arabic_reshaper | |
# install: pip install python-bidi | |
from bidi.algorithm import get_display | |
# install: pip install Pillow | |
from PIL import ImageFont |