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


Groups > comp.lang.python > #31293 > unrolled thread

simple string format question

Started byNeal Becker <ndbecker2@gmail.com>
First post2012-10-15 08:12 -0400
Last post2012-10-15 08:12 -0400
Articles 1 — 1 participant

Back to article view | Back to comp.lang.python


Contents

  simple string format question Neal Becker <ndbecker2@gmail.com> - 2012-10-15 08:12 -0400

#31293 — simple string format question

FromNeal Becker <ndbecker2@gmail.com>
Date2012-10-15 08:12 -0400
Subjectsimple string format question
Message-ID<mailman.2197.1350303164.27098.python-list@python.org>
Is there a way to specify to format I want a floating point written with no more 
than e.g., 2 digits after the decimal?  I tried {:.2f}, but then I get all 
floats written with 2 digits, even if they are 0:

2.35 << yes, that's what I want
2.00 << no, I want just 2 or 2.

[toc] | [standalone]


Back to top | Article view | comp.lang.python


csiph-web