"Per Jr. Greisen" <[EMAIL PROTECTED]> wrote > I need to generate a table with different x,y,z values and write > them to a > file: > 10.171 -15.243 -2.558 > 9.837 -14.511 -1.923 > -23.451 -13.870 51.507 >
others have discussed format strings. One final tip is to put the format string in a variable then use that in printing/writing the output eg: fmt = '%10.3f\t%10.3f\t%10.3f' print fmt % v1,v2,v3 This has the advantage that you can build the format string dynamically by examining the data first - eg the maximum length of an entry. Also by using a minus sign in the format string you can change the justification. HTH, -- Alan Gauld Author of the Learn to Program web site http://www.freenetpages.co.uk/hp/alan.gauld _______________________________________________ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor