sort by column a csv file case insensitive

Lee Chaplin lchaplin13 at gmail.com
Mon Apr 16 02:59:47 EDT 2012


Well, if I have a file like this one:

,,,,EWIENER,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
,,,,edit,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
,,,,edgard,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
,,,,evan,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
,,,,erick,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
,,,,elliott,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
,,,,enquiries,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
,,,,Elliott,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,

I would like to get something like this (sorted by column 4 and case
insensitive):

,,,,edgard,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
,,,,edit,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
,,,,elliott,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
,,,,Elliott,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
,,,,enquiries,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
,,,,erick,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
,,,,evan,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
,,,,EWIENER,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,

(Obviously, there are more data in the other columns, I edited the
file for clarity.)

>From the previous email I would like to call:
sortcsvbyfield('e.txt', 4)

I am on python 2.6 on Win.

Thanks,
Lee



More information about the Python-list mailing list