Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #40672

Re: Insert comma in number?

Path csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!newsfeed.freenet.ag!news2.euro.net!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail
Return-Path <iandouglas736@gmail.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.012
X-Spam-Evidence '*H*': 0.98; '*S*': 0.00; 'example:': 0.03; 'python': 0.09; 'accepts': 0.09; 'calculates': 0.09; 'inserted': 0.09; 'subject:number': 0.09; '1,000': 0.16; 'wrote:': 0.17; 'input': 0.18; 'to:name:python-list@python.org': 0.20; 'import': 0.21; 'to:2**1': 0.23; 'header:In-Reply-To:1': 0.25; 'header:User- Agent:1': 0.26; 'install': 0.29; 'print': 0.32; 'to:addr:python- list': 0.33; 'received:google.com': 0.34; 'pm,': 0.35; 'received:192.168.0': 0.35; 'subject:?': 0.35; 'received:209.85': 0.35; 'message-id:@gmail.com': 0.36; 'received:209': 0.37; 'subject:: ': 0.38; 'instead': 0.39; 'to:addr:python.org': 0.39; 'received:192': 0.39; 'received:192.168': 0.40; 'received:209.85.160.51': 0.84; 'received:mail- pb0-f51.google.com': 0.84; 'eli': 0.93
DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=x-received:message-id:date:from:user-agent:mime-version:to:subject :references:in-reply-to:content-type:content-transfer-encoding; bh=WNKxRBf4uhNhhNGKnC6lRqIvFsaLZTIxGXNSpHSm6cw=; b=F8zJi9J8Ey0b9RKsgexFfON8PjboS5MLll1+4lR5UWK0k7bgjy4EXjf617QHm4/u+k nWCgJXQhWz2Kggifk8FFtmHFm6C4t2SfPxZ8KyJdg6V7PgkJW077H7AyAMJHd0DhUlr6 XbEuRqN4jX6SKn2FqRvUOoZvhkPSGyocgOyHj1lDjfPDWHzNQLub8SlaYkfUpjSY2lhE C6ejtL1Xiej+B1Ex8e54WVmmfJ4svK47c040wP021uvrqcHZ4+PWX0NmWpzSknjw6Fku 4YSYhUN7ZtqffCxG3hP88wKg0LbE+dyVjtR5PL4ZU5zUW3ee6VRi2sD+4PX9gBKkN/5h L5Fw==
X-Received by 10.68.25.138 with SMTP id c10mr50749674pbg.133.1362613873704; Wed, 06 Mar 2013 15:51:13 -0800 (PST)
Date Wed, 06 Mar 2013 15:51:10 -0800
From ian douglas <iandouglas736@gmail.com>
User-Agent Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130221 Thunderbird/17.0.3
MIME-Version 1.0
To eli m <techgeek201@gmail.com>, "python-list@python.org" <python-list@python.org>
Subject Re: Insert comma in number?
References <9c8df3b5-510a-4d00-a3ff-0c59799dcded@googlegroups.com>
In-Reply-To <9c8df3b5-510a-4d00-a3ff-0c59799dcded@googlegroups.com>
Content-Type text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding 7bit
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 <http://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 <http://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.2964.1362613882.2939.python-list@python.org> (permalink)
Lines 16
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1362613882 news.xs4all.nl 6869 [2001:888:2000:d::a6]:42952
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:40672

Show key headers only | View raw


On 03/06/2013 03:39 PM, eli m wrote:
> I have a python program that accepts input and calculates the factorial of that number, and i want to know if i can make it so commas get inserted in the number.
> For example: instead of 1000 it would say 1,000


pip install humanize


import humanize
my_integer = 12345678
commafied_integer = humanize.intcomma(my_integer)
print commafied_integer


output:
12,345,678

Back to comp.lang.python | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

Insert comma in number? eli m <techgeek201@gmail.com> - 2013-03-06 15:39 -0800
  Re: Insert comma in number? ian douglas <iandouglas736@gmail.com> - 2013-03-06 15:51 -0800
  Re: Insert comma in number? Chris Rebert <clp2@rebertia.com> - 2013-03-06 16:07 -0800
  Re: Insert comma in number? Terry Reedy <tjreedy@udel.edu> - 2013-03-06 20:28 -0500
  Re: Insert comma in number? Peter Otten <__peter__@web.de> - 2013-03-07 08:55 +0100
  Re: Insert comma in number? Paul Volkov <capt-obvious@yandex.ru> - 2013-03-07 12:30 +0400
  Re: Insert comma in number? Peter Otten <__peter__@web.de> - 2013-03-07 09:58 +0100

csiph-web