Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #53916
| Path | csiph.com!usenet.pasdenom.info!weretis.net!feeder4.news.weretis.net!rt.uk.eu.org!newsfeed.xs4all.nl!newsfeed2.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail |
|---|---|
| Return-Path | <random832@fastmail.us> |
| X-Original-To | python-list@python.org |
| Delivered-To | python-list@mail.python.org |
| X-Spam-Status | OK 0.011 |
| X-Spam-Evidence | '*H*': 0.98; '*S*': 0.00; '"""': 0.07; 'integers': 0.09; 'received:internal': 0.09; 'subject:question': 0.10; 'def': 0.12; '"""convert': 0.16; 'message- id:@webmail.messagingengine.com': 0.16; 'received:10.202': 0.16; 'received:10.202.2': 0.16; 'received:66.111': 0.16; 'received:66.111.4': 0.16; 'received:66.111.4.27': 0.16; 'received:messagingengine.com': 0.16; 'received:out3-smtp.messagingengine.com': 0.16; 'wrote:': 0.18; '>>>': 0.22; 'header:In-Reply-To:1': 0.27; "skip:' 10": 0.31; "d'aprano": 0.31; 'sep': 0.31; 'steven': 0.31; 'skip:d 20': 0.34; 'received:66': 0.35; 'positive': 0.37; 'received:10': 0.37; 'skip:[ 10': 0.38; 'to:addr:python-list': 0.38; 'does': 0.39; 'to:addr:python.org': 0.39; 'negative': 0.60; 'from:no real name:2**0': 0.61; 'numbers': 0.61; 'header:Message-Id:1': 0.63; '2013,': 0.91; '8bit%:83': 0.91 |
| DKIM-Signature | v=1; a=rsa-sha1; c=relaxed/relaxed; d=fastmail.us; h= message-id:from:to:mime-version:content-transfer-encoding :content-type:in-reply-to:references:subject:date; s=mesmtp; bh= dGIi9a+Oxaz/95Fxs6ScPg/Xbeg=; b=f2NDmnM/hNhGTkD9b20/CPXYG+dZPinR SbfvzqJCoR31cMuUtwYgfFWwBvxv07nwJKaOaT3SgWdGTvYfR2Coei3maVPcr4V4 k1bJZD+XxiuVXYkcD1KofpCIKu9HHw1J3pNwBy4d3SDp6tDqXXY/UtUomN8y8U79 sl9TTHuK268= |
| DKIM-Signature | v=1; a=rsa-sha1; c=relaxed/relaxed; d= messagingengine.com; h=message-id:from:to:mime-version :content-transfer-encoding:content-type:in-reply-to:references :subject:date; s=smtpout; bh=dGIi9a+Oxaz/95Fxs6ScPg/Xbeg=; b=RaC MRO3a/Fvrfq83fXcUajvnlSW2Zqy+3eQA6jYrX1J6gZ1950u0rD+LEhjRM5StJLe qs+Ty6p+mqv9EyJXQ1zigNUMypSU2aBLB3nQbhxwaeN73O+HDua4knYO1gLE2vh2 IqD4IBUGywaDCC+twoQexIbpO0TCEICX37+4H9L8= |
| X-Sasl-Enc | E5r+jg8NU9M1ApWMwURxgzOQVH/Bv15MIQi7JdNLHuqE 1378821025 |
| From | random832@fastmail.us |
| To | python-list@python.org |
| MIME-Version | 1.0 |
| Content-Transfer-Encoding | quoted-printable |
| Content-Type | text/plain; charset="UTF-8" |
| X-Mailer | MessagingEngine.com Webmail Interface - ajax-15090c31 |
| In-Reply-To | <522ec3c0$0$29999$c3e8da3$5496439d@news.astraweb.com> |
| References | <mailman.193.1378757469.5461.python-list@python.org> <522ec3c0$0$29999$c3e8da3$5496439d@news.astraweb.com> |
| Subject | Re: a gift function and a question |
| Date | Tue, 10 Sep 2013 09:50:25 -0400 |
| X-BeenThere | python-list@python.org |
| X-Mailman-Version | 2.1.15 |
| Precedence | list |
| List-Id | General discussion list for the Python programming language <python-list.python.org> |
| List-Unsubscribe | <https://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe> |
| List-Archive | <http://mail.python.org/pipermail/python-list/> |
| List-Post | <mailto:python-list@python.org> |
| List-Help | <mailto:python-list-request@python.org?subject=help> |
| List-Subscribe | <https://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.210.1378821028.5461.python-list@python.org> (permalink) |
| Lines | 15 |
| NNTP-Posting-Host | 2001:888:2000:d::a6 |
| X-Trace | 1378821028 news.xs4all.nl 15888 [2001:888:2000:d::a6]:60281 |
| X-Complaints-To | abuse@xs4all.nl |
| Xref | csiph.com comp.lang.python:53916 |
Show key headers only | View raw
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', '۰۱۲۳۴۵۶۷۸۹'))
> digits = [digit_map[c] for c in str(number)]
> return ''.join(digits)
You can support negative numbers if you use digit_map.get(c,c).
Back to comp.lang.python | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
a gift function and a question Mohsen Pahlevanzadeh <mohsen@pahlevanzadeh.org> - 2013-09-10 00:40 +0430
Re: a gift function and a question Steven D'Aprano <steve@pearwood.info> - 2013-09-10 07:01 +0000
Re: a gift function and a question random832@fastmail.us - 2013-09-10 09:50 -0400
Re: a gift function and a question Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2013-09-10 15:11 +0000
csiph-web