我有一个 csv 文件,其中包含以下行:
question|"N|1|2|3|4|4|30|2|"N|full_answer
为了读取文件,我这样做:
with open('questions.csv', 'r') as question_file:
questions = csv.reader(question_file, delimiter='|', doublequote=False, skipinitialspace=True)
for line in questions:
print(line)
打印的输出是:
['question', 'N|1|2|3|4|4|30|2|N', 'full_answer']
但预期的输出是:
['question', '"N', '1', '2', '3', '4', '4', '30', '2', '"N', 'full_answer']
有什么解决方案可以忽略双引号吗?
翻过高山走不出你
相关分类