【发布时间】:2012-02-09 10:55:20
【问题描述】:
我正在尝试读取包含如下行的 CSV 文件:
test,"test,"test,test,test,test
引号有问题(有六个字段,但是检索为五个字段,如“test”,test被读取为单个字段)。
我已尝试将条目修改如下,但仍然无法检索引号:
test,""test,""test,test,test,test # quotation marks disappear when the entry is read.
test,\"test,\"test,test,test,test # backslashes are also retrieved; escaping doesn't seem to work.
我正在以这种方式读取 CSV 文件:
info_source = csv.reader(open('.info.csv'), skipinitialspace=True)
for row in ling_info_source:
data = row[1].strip()
...
【问题讨论】:
标签: python csv quotation-marks