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: 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: =?UTF-8?B?4K6G4K6u4K6+4K6a4K+N4K6a4K+B?= 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 List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: 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 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