Strip white spaces from CSV file

前端 未结 7 1248
梦谈多话
梦谈多话 2020-12-15 17:02

I need to stripe the white spaces from a CSV file that I read

import csv

aList=[]
with open(self.filename, \'r\') as f:
    reader = csv.reader(f, delimite         


        
7条回答
  •  执念已碎
    2020-12-15 17:28

    with open(self.filename, 'r') as f:
        reader = csv.reader(f, delimiter=',', quoting=csv.QUOTE_NONE)
        return [[x.strip() for x in row] for row in reader]
    

提交回复
热议问题