使用行内的换行符读取CSV

时间:2018-04-15 06:40:31

标签: python pandas csv

我使用Pandas读取CSV文件,但有些行将在下一行继续,delimiter(")将在下一行的开头。我正在尝试为' pd.read_csv'找到参数。这将解决它,但在阅读文档后,我仍然不确定是否有一个。

例如:

"0","","0","0","0","0","0

","0","0","0","0","0","0"

换句话说,

"0","","0","0","0","0","0\r\n","0","0","0","0","0","0"

1 个答案:

答案 0 :(得分:0)

    with open(file, 'rU') as myfile:
        filtered = (line.replace('\n', '') for line in myfile)
        for row in csv.reader(filtered):