John Machin wrote: > A better workaround IMHO is to strip each *field* after it is received > from the csv reader. In fact, it is very rare that leading or trailing > space in CSV fields is of any significance at all. Multiple spaces > ditto. Just do this all the time: > > row = [' '.join(x.split()) for x in row]
The problem with removing the spaces after they are received from the csv reader is if you want to use DictReader. I like to use DictReader, without passing it the field list. The module then reads the field list from the first line, and in this situation you don't get an opportunity to strip the spaces from that. -- http://mail.python.org/mailman/listinfo/python-list