Awkward format string

Neil Cerutti horpner at yahoo.com
Wed Aug 1 12:46:53 EDT 2007


On 2007-08-01, beginner <zyzhu2000 at gmail.com> wrote:
> print  >>f, "%s\t%s\t%d\t%f\t%f\t%f\t%d" %
> (x.field1..strftime("%Y-%m- %d"),
> x.field2..strftime("%Y-%m-%d"), x.field3, x.field4, x.field5,
> x.field.6, x.field7)
>
> This is also tedious and error-prone.

Providing a suitable .str or .__repr__ method for your class
may make that problem disappear.

-- 
Neil Cerutti



More information about the Python-list mailing list