printing with variable length of list

Dan Bishop danb_83 at yahoo.com
Tue Oct 19 02:00:33 CEST 2004


les_ander at yahoo.com (les ander) wrote in message news:<a2972632.0410181055.50898f64 at posting.google.com>...
> Hi,
> suppose I have a list
> d=[1.2 , 31.1, 1.001]
> in general i will not know the size of d
> however, I would like to print them out nicely in the row format
> such as:
> print "%-10f "* len(d) % d

Try:

print "%-10f " * len(d) % tuple(d)



More information about the Python-list mailing list