Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #43576
| Path | csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!newsfeed.xs4all.nl!newsfeed3.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail |
|---|---|
| Return-Path | <msirenef@lightbird.net> |
| X-Original-To | python-list@python.org |
| Delivered-To | python-list@mail.python.org |
| X-Spam-Status | OK 0.029 |
| X-Spam-Evidence | '*H*': 0.94; '*S*': 0.00; 'python:': 0.09; "','": 0.16; 'comma': 0.16; 'received:74.55.86': 0.16; 'received:74.55.86.74': 0.16; 'received:smtp.webfaction.com': 0.16; 'received:webfaction.com': 0.16; 'separator,': 0.16; 'subject:howto': 0.16; 'subject:remove': 0.16; 'wrote:': 0.18; 'header:User-Agent:1': 0.23; 'header:In-Reply-To:1': 0.27; 'received:192.168.1.3': 0.31; 'subject:the': 0.34; 'problem': 0.35; 'hi,': 0.36; 'to:addr:python-list': 0.38; 'pm,': 0.38; 'to:addr:python.org': 0.39; 'how': 0.40; 'remove': 0.60; 'such': 0.63; 'reply': 0.66; 'friend': 0.79 |
| Date | Sun, 14 Apr 2013 15:16:52 -0400 |
| From | Mitya Sirenef <msirenef@lightbird.net> |
| User-Agent | Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130329 Thunderbird/17.0.5 |
| MIME-Version | 1.0 |
| To | python-list@python.org |
| Subject | Re: howto remove the thousand separator |
| References | <201304150257331336590@gmail.com> |
| In-Reply-To | <201304150257331336590@gmail.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.597.1365967017.3114.python-list@python.org> (permalink) |
| Lines | 24 |
| NNTP-Posting-Host | 2001:888:2000:d::a6 |
| X-Trace | 1365967017 news.xs4all.nl 2701 [2001:888:2000:d::a6]:53627 |
| X-Complaints-To | abuse@xs4all.nl |
| Xref | csiph.com comp.lang.python:43576 |
Show key headers only | View raw
On 04/14/2013 02:57 PM, pyth0n3r wrote:
> Hi,
> I came across a problem that when i deal with int data with ',' as
thousand separator, such as 12,916, i can not change it into int() or
float().
> How can i remove the comma in int data?
> Any reply will be appreciated!!
>
> Best,
> Chen
>
>
>
I would do int(num.replace(',', ''))
-m
--
Lark's Tongue Guide to Python: http://lightbird.net/larks/
When a friend succeeds, I die a little. Gore Vidal
Back to comp.lang.python | Previous | Next | Find similar | Unroll thread
Re: howto remove the thousand separator Mitya Sirenef <msirenef@lightbird.net> - 2013-04-14 15:16 -0400
csiph-web