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


Groups > comp.lang.python > #42327

round off to two decimal & return float

Path csiph.com!usenet.pasdenom.info!weretis.net!feeder4.news.weretis.net!rt.uk.eu.org!newsfeed.xs4all.nl!newsfeed1.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail
Return-Path <amachu@amachu.me>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.077
X-Spam-Evidence '*H*': 0.85; '*S*': 0.01; 'assign': 0.07; 'subject:two': 0.07; 'string': 0.09; 'aligned.': 0.16; 'trying': 0.19; 'preferred': 0.22; 'header:User-Agent:1': 0.23; 'received:208.97': 0.31; 'received:208.97.132': 0.31; 'received:dreamhost.com': 0.31; 'received:g.dreamhost.com': 0.31; 'text': 0.33; 'but': 0.35; 'method': 0.36; 'to:addr:python-list': 0.38; 'to:addr:python.org': 0.39; 'received:208': 0.61; 'from:charset:utf-8': 0.61; 'subject: & ': 0.68; 'sri': 0.84; 'subject:round': 0.84
DKIM-Signature v=1; a=rsa-sha1; c=relaxed; d=amachu.me; h=message-id :date:from:mime-version:to:subject:content-type: content-transfer-encoding; s=amachu.me; bh=lfXJioLQpxozd2DNdrWb2 bXZgM8=; b=TZBKpzhTDn2sy+EnCWgThQJSYTsAIdmNARtwxEco2cyTcWVm6okud csmrnfxYJSbxR4b/s9GSRCJZWq8QVRtA0jfMf91H+Ym27YlhITT57OYmT+CgY1mh 8zzQPVQbek+Y7eQC1ODZnde7rDXK7OzvgGFQv6rVQ2ATYIeDPmrYTs=
Date Sat, 30 Mar 2013 13:22:59 +0530
From ஆமாச்சு <amachu@amachu.me>
User-Agent Mozilla/5.0 (X11; Linux i686; rv:17.0) Gecko/20130308 Thunderbird/17.0.4
MIME-Version 1.0
To python-list@python.org
Subject round off to two decimal & return float
Content-Type text/plain; charset=UTF-8
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.3990.1364630137.2939.python-list@python.org> (permalink)
Lines 17
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1364630137 news.xs4all.nl 6882 [2001:888:2000:d::a6]:40650
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:42327

Show key headers only | View raw


Consider the scenario,

>> a = 10
>> "{0:.2f}".format(a)
'10.00'

This returns a string 10.00. But what is the preferred method to retain
10.0 (float) as 10.00 (float)?

I am trying to assign the value to a cell of a spreadsheet, using
python-xlwt. I would like to have 10.00 as the value that is right
aligned. With text it is left aligned.

--

Sri Ramadoss M

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


Thread

round off to two decimal & return float ஆமாச்சு <amachu@amachu.me> - 2013-03-30 13:22 +0530
  Re: round off to two decimal & return float pyplexed <julius.welby@gmail.com> - 2013-03-30 02:30 -0700
  Re: round off to two decimal & return float pyplexed <julius.welby@gmail.com> - 2013-03-30 02:30 -0700

csiph-web