String.maketrans for English and Persian numbers
See unidecode library which converts all strings into UTF8. It is very useful in case of number input in different languages. In Python 2: >>> from unidecode import unidecode >>> a = unidecode(u”۰۱۲۳۴۵۶۷۸۹”) >>> a ‘0123456789’ >>> unidecode(a) ‘0123456789’ In Python 3: >>> from unidecode import unidecode >>> a = unidecode(“۰۱۲۳۴۵۶۷۸۹”) >>> a ‘0123456789’ >>> … Read more