I’m using the code below to print out rows containing 4 columns. How would I append each value in the list to a HTML table that also contains rows with four columns?
random_list = ['car', 'plane', 'van', 'boat', 'ship', 'jet','shuttle']
for i in xrange(0, len(food_list), 4):
print '\t'.join(food_list[i:i+4])
With some minor modification…
This basically changes the delimiter to not be tab, but the table elements. Also, puts the open row and close row at the beginning and end.