我需要删除csv
中引号之间的新行输入Ex:
"P.O. Box 160
Big Bay, MI 49808(46.84808584900048, -87.8395882969997)"
我需要输出
"P.O. Box 160 Big Bay, MI 49808(46.84808584900048, -87.8395882969997)"
我正在尝试这个但是所有的线都消失了,我想我错过了什么......这里有任何帮助..
import csv
with open("input.csv", "rb") as input, open("output.csv", "wb") as output:
w = csv.writer(output)
for record in csv.reader(input):
w.writerow(tuple(s.remove(""\n"") for s in record))
答案 0 :(得分:1)
使用string.replace方法
string.replace("\n", "")