Re: a gift function and a question

2013-09-10 Thread Steven D'Aprano
On Tue, 10 Sep 2013 07:01:20 +, Steven D'Aprano wrote: > On Tue, 10 Sep 2013 00:40:59 +0430, Mohsen Pahlevanzadeh wrote: >> My question is , do you have reverse of this function? >> persianToInteger? > > The Python built-in int function already supports that: > > > py> int('۳۴۵۵') > 3455

Re: a gift function and a question

2013-09-10 Thread random832
On Tue, Sep 10, 2013, at 3:01, Steven D'Aprano wrote: > def integerToPersian(number): > """Convert positive integers to Persian. > > >>> integerToPersian(3455) > '۳۴۵۵' > > Does not support negative numbers. > """ > digit_map = dict(zip('0123456789', '۰۱۲۳۴۵۶۷۸۹')) > d

Re: a gift function and a question

2013-09-10 Thread Peter Otten
Mohsen Pahlevanzadeh wrote: > I completed my two functions, i say may be poeple can use them: > ##33 > def integerToPersian(number): > listedPersian = ['۰','۱','۲','۳','۴','۵','۶','۷','۸','۹'] > listedEnglish = ['0','1','2','3','4','5','6','7','8','9'] >

Re: a gift function and a question

2013-09-10 Thread Steven D'Aprano
On Tue, 10 Sep 2013 00:40:59 +0430, Mohsen Pahlevanzadeh wrote: > Dear all, > > I have a gift for mailing list: > > > def integerToPersian(number): > listedPersian = ['۰','۱','۲','۳','۴','۵','۶','۷','۸','۹'] > listedEnglish = ['0','1','2','3','4','5','6',

Re: a gift function and a question

2013-09-09 Thread Mohsen Pahlevanzadeh
I completed my two functions, i say may be poeple can use them: ##33 def integerToPersian(number): listedPersian = ['۰','۱','۲','۳','۴','۵','۶','۷','۸','۹'] listedEnglish = ['0','1','2','3','4','5','6','7','8','9'] returnList = list()

Re: a gift function and a question

2013-09-09 Thread random832
On Mon, Sep 9, 2013, at 16:10, Mohsen Pahlevanzadeh wrote: > My question is , do you have reverse of this function? persianToInteger? The int constructor is able to handle different forms of decimal numerals directly: >>> int('\u06f3\u06f4\u06f5\u06f5') 3455 -- https://mail.python.org/mailman/li

a gift function and a question

2013-09-09 Thread Mohsen Pahlevanzadeh
Dear all, I have a gift for mailing list: def integerToPersian(number): listedPersian = ['۰','۱','۲','۳','۴','۵','۶','۷','۸','۹'] listedEnglish = ['0','1','2','3','4','5','6','7','8','9'] returnList = list() listedTmpString = list(str(numb