Strip white spaces from CSV file

There’s also the embedded formatting parameter: skipinitialspace (the default is false)
http://docs.python.org/2/library/csv.html#csv-fmt-params

aList=[]
with open(self.filename, 'r') as f:
    reader = csv.reader(f, skipinitialspace=False,delimiter=",", quoting=csv.QUOTE_NONE)
    for row in reader:
        aList.append(row)
    return(aList)

Leave a Comment