我在 python 中读取 csv 文件时遇到了一些问题我有我的数据,但有些列里面有双引号,例如:
First field First Row,This is the second field in the first row
First Field Second Row,This is the "second" field in the second row
所以,我的 csv 阅读器如下:
with open('data.csv', encoding="utf-8") as csv_file:
csv_reader = csv.reader(csv_file, delimiter=',')
问题是,当我遍历行时,当它检查第二行时,由于某种原因它不会在“,”上拆分列。所以当我打印每一行时我得到了这个:
['First field First Row' , 'This is the second field in the first row']
['First Field Second Row,This is the "second" field in the second row']
有什么解决方法可以正确拆分吗?
提前致谢!