-2
我需要在csv文件中写入前73行,然后将“0”分配给坐标列中的空白,但我不确定需要对其进行的更改该脚本正确地将字符串“0”分配给文件中的36和37列。将csv文件中的空白坐标设置为0 python
while line:
lineList = line.split(',')
newList = lineList[:72]
if 36 or 37 in newList == "":
36 = "0"
37 = "0"
line = ",".join(lineList)
line = line + '\n'
colFinal.write(line)
这里有很多逻辑错误。 'while line:'should expect to loop forever,and'如果newList == 36或37中没有任何意义,但无论如何总是计算为True,然后尝试将值赋给整数文字是非法的。 – geoffspear 2013-04-27 21:30:30
我很新的python,所以我不知道需要更正哪些更正 – user2316620 2013-04-27 21:32:53