Formatting a column's value output
rurpy at yahoo.com
rurpy at yahoo.com
Sun Jan 27 11:12:59 EST 2013
More information about the Python-list mailing list
Sun Jan 27 11:12:59 EST 2013
- Previous message (by thread): Formatting a column's value output
- Next message (by thread): Formatting a column's value output
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
On 01/27/2013 02:04 AM, Ferrous Cranus wrote: >[...] > data = cur.fetchall() > for row in data: > print ( "<tr>" ) > > for item in row: > print( '''<td> <a href='http://www.%s?show=log'>%s</a> </td>''' % (item, item) ) >[...] > Okey, so far BUT i want the url linking to happen only for the URL column's > value, and not for the hits column too. How do i apply the url link to the > URL column's value only? Ferrous, 'row' has two items (the url and the hit count) in it, right? So print each separately rather than in a loop: data = cur.fetchall() for row in data: url = row[0] hits = row[1] print ( "<tr>" ) print( "<td> <a href='http://www.%s?show=log'>%s</a> </td>: % (url, hits) )
- Previous message (by thread): Formatting a column's value output
- Next message (by thread): Formatting a column's value output
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Python-list mailing list