skipinitialspace=True
を指定することで先頭の半角スペースだけ削除できます。
import csv
csv_file = open('sample.csv', 'r', encoding='cp932', errors='', newline='')
f = csv.reader(csv_file, delimiter=',', doublequote=True, lineterminator='\r\n', quotechar="'", skipinitialspace=True)
newfile = open('sample_nospaces.csv', 'w', encoding='cp932')
writer = csv.writer(newfile, doublequote=True, lineterminator='\n')
header = next(f)
writer.writerow(header)
for row in f:
row = row
writer.writerow(row)
csv_file.close()
sample.csv
id,NO1,NO2,NO3,NO4,NO5
101,1,1,1,1,1
102, a b , a b,1,2 ,1
103, ,,,,
104, , 3,1,1,1
sample_nospaces.csv
id,NO1,NO2,NO3,NO4,NO5
101,1,1,1,1,1
102,a b ,a b,1,2 ,1
103,,,,,
104,,3,1,1,1