Re: Awkward format string

2007-08-02 Thread Gerard Flanagan
On Aug 1, 11:52 pm, Ian Clark [EMAIL PROTECTED] wrote: Gerard Flanagan wrote: (snip) def tostring(data): return tuple(strftime(x) for x in data[:2]) + data[2:] Hrmm, not sure that having a function named tostring() that returns a tuple is the best idea. ;) oops! SAD (Solipsistic

Re: Awkward format string

2007-08-02 Thread Bruno Desthuilliers
beginner a écrit : Hi, In order to print out the contents of a list, sometimes I have to use very awkward constructions. For example, I have to convert the datetime.datetime type to string first, construct a new list, s/list/tuple/ and then send it to print. The following is an example.

Re: Awkward format string

2007-08-02 Thread beginner
On Aug 2, 3:32 am, Bruno Desthuilliers bruno. [EMAIL PROTECTED] wrote: beginner a écrit : Hi, In order to print out the contents of a list, sometimes I have to use very awkward constructions. For example, I have to convert the datetime.datetime type to string first, construct a new

Awkward format string

2007-08-01 Thread beginner
Hi, In order to print out the contents of a list, sometimes I have to use very awkward constructions. For example, I have to convert the datetime.datetime type to string first, construct a new list, and then send it to print. The following is an example. x=(e[0].strftime(%Y-%m-%d),

Re: Awkward format string

2007-08-01 Thread beginner
On Aug 1, 11:31 am, Chris Mellon [EMAIL PROTECTED] wrote: On 8/1/07, beginner [EMAIL PROTECTED] wrote: Hi, In order to print out the contents of a list, sometimes I have to use very awkward constructions. For example, I have to convert the datetime.datetime type to string first,

Re: Awkward format string

2007-08-01 Thread Chris Mellon
On 8/1/07, beginner [EMAIL PROTECTED] wrote: Hi, In order to print out the contents of a list, sometimes I have to use very awkward constructions. For example, I have to convert the datetime.datetime type to string first, construct a new list, and then send it to print. The following is an

Re: Awkward format string

2007-08-01 Thread Ian Clark
beginner wrote: Hi, In order to print out the contents of a list, sometimes I have to use very awkward constructions. For example, I have to convert the datetime.datetime type to string first, construct a new list, and then send it to print. The following is an example.

Re: Awkward format string

2007-08-01 Thread Chris Mellon
On 8/1/07, beginner [EMAIL PROTECTED] wrote: On Aug 1, 11:31 am, Chris Mellon [EMAIL PROTECTED] wrote: On 8/1/07, beginner [EMAIL PROTECTED] wrote: Hi, In order to print out the contents of a list, sometimes I have to use very awkward constructions. For example, I have to convert

Re: Awkward format string

2007-08-01 Thread Neil Cerutti
On 2007-08-01, beginner [EMAIL PROTECTED] 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

Re: Awkward format string

2007-08-01 Thread [EMAIL PROTECTED]
On Aug 1, 9:42 am, beginner [EMAIL PROTECTED] wrote: (snipped) e is not complicated. It is a record that have 7 fields. In my program a function outputs a list of tuples, each is of type e, and now I just need to send them to a text file. I have no problem using classes and I do use them

Re: Awkward format string

2007-08-01 Thread Gerard Flanagan
On Aug 1, 6:11 pm, beginner [EMAIL PROTECTED] wrote: Hi, In order to print out the contents of a list, sometimes I have to use very awkward constructions. For example, I have to convert the datetime.datetime type to string first, construct a new list, and then send it to print. The following

Re: Awkward format string

2007-08-01 Thread Ian Clark
Gerard Flanagan wrote: (snip) def tostring(data): return tuple(strftime(x) for x in data[:2]) + data[2:] Hrmm, not sure that having a function named tostring() that returns a tuple is the best idea. ;) Ian -- http://mail.python.org/mailman/listinfo/python-list