Replace map with list comprehensions

svn: r10848
This commit is contained in:
Gerald Britton 2008-07-09 14:39:10 +00:00
parent 4afaea5c72
commit 02484820e2

View File

@ -32,7 +32,6 @@
import time import time
from gettext import gettext as _ from gettext import gettext as _
import csv import csv
import string
import codecs import codecs
import cStringIO import cStringIO
@ -329,11 +328,8 @@ class CSVParser:
except: except:
pass pass
return None return None
data = []
try: try:
for row in reader: data = [[r.strip() for r in row] for row in reader]
row = map(string.strip, row)
data.append( row )
except csv.Error, e: except csv.Error, e:
ErrorDialog(_('format error: file %s, line %d: %s') % ErrorDialog(_('format error: file %s, line %d: %s') %
(self.filename, reader.line_num, e)) (self.filename, reader.line_num, e))
@ -409,7 +405,7 @@ class CSVParser:
continue continue
###################################### ######################################
if header is None: if header is None:
header = map(cleanup_column_name, row) header = [cleanup_column_name(r) for r in row]
col = {} col = {}
count = 0 count = 0
for key in header: for key in header: