Hi all, I am trying to sort, in place, by column, a csv file AND sort it case insensitive. I was trying something like this, with no success:
import csv import operator def sortcsvbyfield(csvfilename, columnnumber): with open(csvfilename, 'rb') as f: readit = csv.reader(f) thedata = list(readit) thedata = sorted(thedata, key = lambda x: (operator.itemgetter(columnnumber) ,x[0].lower())) #!!! with open(csvfilename, 'wb') as f: writeit = csv.writer(f) writeit.writerows(thedata) The line marked is the culprit. Any help is greatly appreciated. Thanks, Lee -- http://mail.python.org/mailman/listinfo/python-list