On 20/08/14 20:06, Terry--gmail wrote:
We are not quite out of the woods on this last example
lens = [0] * len(catalog2[0])
This is what happens when you don't test code. My apologies, the initialisation is all wrong. Try this instead: lens = [ [] for n in catalog2[0] ] That adds an empty list for each element in catalog2's header.
for row in catalog2: for col, item in enumerate(row): print(col, item, len(item)) lens[col].append(len(item)) lens = [max(col) for col in lens]
This should now work... although I still haven't tested it! -- Alan G Author of the Learn to Program web site http://www.alan-g.me.uk/ http://www.flickr.com/photos/alangauldphotos _______________________________________________ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: https://mail.python.org/mailman/listinfo/tutor