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


Groups > comp.lang.python > #77010

Re: Working with decimals part 2

From alex23 <wuwei23@gmail.com>
Newsgroups comp.lang.python
Subject Re: Working with decimals part 2
Date 2014-08-26 10:46 +1000
Organization A noiseless patient Spider
Message-ID <ltgle2$ji8$1@dont-email.me> (permalink)
References <hsomv9hvf31ntf45rr2ukhb0078cubovre@4ax.com>

Show all headers | View raw


On 26/08/2014 3:55 AM, Seymore4Head wrote:
> I changed the program just a little to give myself a little practice
> with number formats.  The main thing I wanted to do was make the
> decimal points line up.  The problem I am having is with the print
> (count)(payment)(balance) line.

While I don't want to discourage you from learning how to do it the long 
way, when you have a handle on it I highly recommend using a library for 
producing tabular data. tabulate is a very handy one, which supports 
lining up decimal points, amongst many other features:

https://pypi.python.org/pypi/tabulate

I personally find formatting text to be a pain and will always look for 
a better method.

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