Struggling to convert a mysql datetime object to a python string of a different format

Νίκος nikos.the.gr33k at gmail.com
Thu Aug 5 14:52:58 EDT 2010


Hey i made it! :-)

dataset = cursor.fetchall()

for row in dataset:
    print ( ''' <tr> ''' )

    date = row[2].strftime( '%d %b, %H:%M' )

    print ( ''' <td> %s </td>	<td> %s </td>	<td> %s </td> ''' %
( row[0], row[1], date ) )

Unfortunately had to ditch the 'for entry in row' line because
couldn't iterate over the items of the row.

Could you please shoe me how could i do the same thing with
iteration?!
Thanks!



More information about the Python-list mailing list