Tim Chase wrote:
>> for col in range(0, numcols):
>> print "<td>", record[col], "</td>"
>
> This is the point at which you want to intercept the column data and
> make your change:
>
> print "<td>", str(record[col]).replace("00:00:00.0", ""), "</td"
>
> If it's possible/plausible that other fields might have such a value
> reasonably, then you'd want to do a check, something like
>
>
> THEDATECOL = 42
> for col in range(0, numcols):
> foo = record[col]
> if col == THEDATECOL:
> foo = foo.replace("00:00:00.00", "")
> print "<td>%s</td>" % foo
>
> or alternatively
>
> DATECOLUMNS = [3, 14]
> for col in range(0, numcols):
> foo = record[col]
> if col in DATECOLUMNS:
> foo = foo.replace("00:00:00.00", "")
> print "<td>%s</td>" % foo
>
> I don't know off the top of my head if your MySQL cursor object supports
> metadata...something like the following pseudocode:
>
> for col in range(0, numcols):
> foo = record[col]
> if cursor.fieldtypes[col] == MYSQL_DATE:
> foo = foo.replace("00:00:00.00", "")
> print "<td>%s</td>" % foo
>
> Adjust accordingly.
>
> -tkc
> much thanks!
>
>
>
>
mu
--
http://mail.python.org/mailman/listinfo/python-list