Chris Roy-Smith wrote: > Hi > Python 3.4 Linux (ubuntu) > > This code does what I want. > curs is the result of a mysql query > > > data = [[" " for x in range(9)] for y in range(count)] > for (ddate, mood, walk, lag, sleep) in curs: > data[row][0]=ddate > data[row][1]=mood > data[row][2]=walk > data[row][3]=lag > data[row][4]=sleep > row +=1 > > > While I don't know a better way to do this, it seems a bit awkward, is > there a better way?
Does `curs` give `count` records? If so: data = [ list(row) + [" "] * 4 for row in curs ] _______________________________________________ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: https://mail.python.org/mailman/listinfo/tutor