我有这个简单的python脚本:
with open("records.csv", "r") as f:
for line in f:
print line
records.cvs
包含许多行,如下所示。
,0.055,,,,109.889456433,119.043269058,128.455997141,,,,-0.607526459169,-1.28987216622,-1.36255539212,-0.0783128865694,-0.0745923352488,-0.0722692557059,0.325311331044,0.61140286319,0.0509661014105,0.719556483734
但是,我们上面的脚本打印以下输出,字符之间有空格。
■,0。0 5 5 , , , , 1 0 9 。8 8 9 4 5 6 4 3 3 , 1 1 9 。0 4 3 2 6 9 0 5 8 , 1 2 8 。4 5 5 9 9 7 1 4 1 , , , , - 0 。6 0 7 5 2 6 4 5 9 1 6 9, - 1。2 8 9 8 7 2 1 6 6 2 2,-1。3 6 2 5 5 5 3 9 2 1 2,-0。0 7 8 3 1 2 8 8 6 5 6 9 4,-0。0 7 4 5 9 2 3 3 5 2 4 8 8 , - 0 。0 7 2 2 6 9 2 5 5 7 0 5 9 , 0 。3 2 5 3 1 1 3 3 1 0 4 4 , 0 。6 1 1 4 0 2 8 6 3 1 , 0 。0 5 0 9 6 6 1 0 1 4 1 0 5 , 0 。7 1 9 5 5 6 4 8 3 7 3 4
为什么输出有空格,我们如何删除它们。