[Tutor] simple report writing?

Kent Johnson kent37 at tds.net
Mon Nov 7 20:20:08 CET 2005


CPIM Ronin wrote:
> Can someone suggest a specific tutorial strictly on report writing?
> 
> I'm able to write reports fairly easily in Python. I know the stuff like 
> str(round(x,2)) where x = 3.145678 will yield 3.14. What I'm looking for is 
> to be able to control left and right justification, column by column while 
> using string and numeric data of variable lengths so that my reports look 
> much neater.

Do you know about the string formatting operator %?
http://docs.python.org/lib/typesseq-strings.html

You might also be interested in this recipe which formats a table for output:
http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/267662

Kent



More information about the Tutor mailing list