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


Groups > comp.lang.python > #76995

Re: Working with decimals part 2

Path csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!newsfeed.fsmpi.rwth-aachen.de!news.mixmin.net!feeds.phibee-telecom.net!newsfeed.xs4all.nl!newsfeed1.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail
Return-Path <rosuav@gmail.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.020
X-Spam-Evidence '*H*': 0.96; '*S*': 0.00; 'talks': 0.03; 'binary': 0.07; 'error:': 0.07; 'reason,': 0.07; "system's": 0.09; 'cc:addr :python-list': 0.11; 'python': 0.11; 'floats;': 0.16; 'formatted': 0.16; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'mode,': 0.16; 'uploading': 0.16; 'exception': 0.16; 'wrote:': 0.18; 'possible,': 0.19; 'working.': 0.19; 'written': 0.21; '>>>': 0.22; 'aug': 0.22; 'saying': 0.22; 'separate': 0.22; 'cc:addr:python.org': 0.22; 'error': 0.23; 'module,': 0.24; 'cc:2**0': 0.24; 'header:In-Reply-To:1': 0.27; 'point': 0.28; 'am,': 0.29; 'message-id:@mail.gmail.com': 0.30; 'decimal': 0.31; 'probably': 0.32; 'figure': 0.32; 'quite': 0.32; 'actual': 0.34; 'message.': 0.35; 'subject:with': 0.35; 'received:google.com': 0.35; 'there': 0.35; 'really': 0.36; 'doing': 0.36; 'easiest': 0.38; 'files': 0.38; 'little': 0.38; 'bad': 0.39; 'simple': 0.61; "you're": 0.61; "you've": 0.63; 'show': 0.63; 'different': 0.65; 'due': 0.66; '26,': 0.68; 'subject': 0.69; 'url:i': 0.72; 'url:jpg': 0.83; '"it': 0.84; 'confusing': 0.84; 'url:imgur': 0.84; 'yours': 0.88; 'capture': 0.91; 'to:none': 0.92
DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:cc :content-type; bh=DXK+wleaAHD2c7gOSOB2nqGzz5djs3/0U7UivEkqI6I=; b=tPjFhMoX4M2bnCkJz1pihRIRxznLMsicAThZUmHSuyRCqe/uHQBXWXPJpX4liudV+J ux8Vpg7zmUG1v64FuKxbsiDyR4piZD5zeGgFwJiMSBi6tjZc8GLugSXKwkv+hBM9g5wW iJdJgi/pu53wis6wMvmEusNsFdwgVNU9NAJPUDKsLzErXGMPArh/R2VrE4SCSiHxCwU8 QJohA9GuIb36sKUbOiXBfPjry+Mg7ImH7ZF8Y95Uy8hzh7oKsOI+pQcBYtzDJKYzXj2V FZIWj+NppYpPER9Dn+/9HQ9T6GNig3pyu2ZDlU1g2ch2575QV9VfJHy6ZF+el3zChM8b 7Teg==
MIME-Version 1.0
X-Received by 10.50.66.197 with SMTP id h5mr17334505igt.34.1408990566737; Mon, 25 Aug 2014 11:16:06 -0700 (PDT)
In-Reply-To <hsomv9hvf31ntf45rr2ukhb0078cubovre@4ax.com>
References <hsomv9hvf31ntf45rr2ukhb0078cubovre@4ax.com>
Date Tue, 26 Aug 2014 04:16:06 +1000
Subject Re: Working with decimals part 2
From Chris Angelico <rosuav@gmail.com>
Cc "python-list@python.org" <python-list@python.org>
Content-Type text/plain; charset=UTF-8
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.13425.1408990569.18130.python-list@python.org> (permalink)
Lines 33
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1408990569 news.xs4all.nl 2871 [2001:888:2000:d::a6]:51794
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:76995

Show key headers only | View raw


On Tue, Aug 26, 2014 at 3:55 AM, Seymore4Head
<Seymore4Head@hotmail.invalid> wrote:
> For some reason, it is not working.  If I try to use row2 I get this
> error:
> http://i.imgur.com/FgeF9c9.jpg

Several meta-issues.

Firstly, your subject line talks about 'decimal' again. You're
actually working with floats; Python has a quite separate decimal
module, and it's not what you're doing here. It's confusing for those
of us who know that you're actually working in binary floating point
:)

Secondly: An image is a really bad way to capture an error message.
Instead of saying "it is not working" and uploading a screenshot to
imgur, just copy and paste the exception into the body of the email.

Thirdly: If you're working iteratively, keep the files as simple as
possible, and if you can do this as one-liners in Idle's interactive
mode, that's probably the easiest way to show us what's happening.
Don't bury all of them in together into a single program.

As to your actual issue... it's a little unclear, because the system's
interpretation of what you've written is completely different from
yours - due to one misplaced bracket.

>>> str(format(number), ',.2f'))

You want to format the number .2f, not str the formatted number .2f. I
think you can figure it out from there :)

ChrisA

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


Thread

Working with decimals part 2 Seymore4Head <Seymore4Head@Hotmail.invalid> - 2014-08-25 13:55 -0400
  Re: Working with decimals part 2 Chris Angelico <rosuav@gmail.com> - 2014-08-26 04:16 +1000
  Re: Working with decimals part 2 Mark Lawrence <breamoreboy@yahoo.co.uk> - 2014-08-25 19:23 +0100
  Re: Working with decimals part 2 MRAB <python@mrabarnett.plus.com> - 2014-08-25 19:26 +0100
  Re: Working with decimals part 2 alex23 <wuwei23@gmail.com> - 2014-08-26 10:46 +1000
    Re: Working with decimals part 2 Seymore4Head <Seymore4Head@Hotmail.invalid> - 2014-08-27 19:55 -0400

csiph-web