Working with decimals part 2

alex23 wuwei23 at gmail.com
Mon Aug 25 20:46:56 EDT 2014


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.




More information about the Python-list mailing list