파이썬

python(vscode)/csv 띄어쓰기 지우기

gongdol 2024. 3. 24. 22:01
300x250
1
2
3
4
5
import csv
alist=[]

with
 open('list.csv','r'as csvfile, open('complete_list.csv','w',newline=""as csvfile1:  # newline="" to avoid blanks
   reader = csv.reader(stripped,skipinitialspace=True,delimiter=',')
for row in reader:
alist.append(row)
    writer= csv.writer(csvfile1)
   writer.writerows( alist )   # don't overstrip: just write rows as-is
cs

 

300x250