Hi,
I am using MySQL and python server pages to show the data in a database. In the db I have selected this data: a list x =[1, 61, 121, 181, 241, 301]
and a list of lists z = (['a','b'],['c','d'],['e','f'],['g','h'],['i','j'],['k','l'])
and I would like to put these in a table to look like:
001 a b
061 c d
121 e f
181 g h
241 i j
301 k l
Am I right in thinking that I would have to use two 'for loops' to do this? Here is what I am using:
rows = cur.fetchall()
z=[]
for row in rows:
z.append(dict[row[1]])
x=[]
for i in range(1, len(rows),60):
x.append(i)
for i in range(0,len(z), 60):
req.write("<tr><td>%s</td><td>%s</td></tr>" %(str(x[i:i+60]), str(z[i:i+60])))
And this is what I'm outputting:
[1, 61, 121, 181, 241, 301] a b
c d
e f
g h
i j
k l
Any help would be massively appreciated!
Cheers