With some minor changes ...
food_list = ['car', 'plane', 'van', 'boat', 'ship', 'jet','shuttle']
for i in xrange(0, len(food_list), 4):
print '<tr><td>' + '</td><td>'.join(food_list[i:i+4]) + '</td></tr>'
Basically, this changes the delimiter so as not to be a tab, but table elements. It also places the open line and the closing line at the beginning and end.
source
share