附件是一个 CSV 文件,其中每个数据前后存在空格,请对其进行清洗,要求如下:
示例1:
输入:"
1, 2, 3, 4, 5
'a', 'b' , 'c' , 'd','e'
"
输出:"
1,2,3,4,5
'a','b','c','d','e'
"
注意:
with open("data.csv","r") as fp:#打开文件
for line in fp:#按行遍历
line = line.replace(" ", "")#将空格替换为""
print(line, end="")#按行输出