Python CSV新行字符和引号内的qoute字段

Python CSV新行字符和引号内的qoute字段,python,csv,Python,Csv,我在csv.reader中尝试了很多选项,但都不起作用。我是python新手,几乎尝试了所有参数,csv文件中的一条凌乱消息如下所示 "Hey Hi how are you all,I stuck into this problem,i have tried with such parameter but exceeding the existing number of records,in short file is not getting read properly. \"I have t

我在csv.reader中尝试了很多选项,但都不起作用。我是python新手,几乎尝试了所有参数,csv文件中的一条凌乱消息如下所示

"Hey Hi

how are you all,I stuck into this problem,i have tried with such parameter but exceeding the existing number of records,in short file is not getting read properly.
\"I have tried with 
datareader=csv.reader(csvfile,quotechar='"',lineterminator='\n\n\n\r\r',quoting=csv.QUOTE_ALL)

Error: new-line character seen in unquoted field - do you need to open the file in universal-newline mode? \"......... hence the problem continue.

"
正如预期的那样,由于消息中的\“\n获取更多记录或记录中断,我尝试了不同的行终止符,正如您在消息中看到的那样,但没有成功,这是我的代码

with open("D:/Python/mssg5.csv", "r") as csvfile:
        datareader = csv.reader(csvfile,quotechar='"' ,lineterminator='\n',quoting=csv.QUOTE_ALL)
        count = 0
    #csv_out = open('D:/Python/mycsv.csv', 'wb')
    #mywriter = csv.writer(csv_out)
        for row in datareader:
            count = count + 1
            print "COUNT is :%d" % count

任何形式的帮助,谢谢。

在csv文件中尝试几件事:

  • 将乱七八糟的字符串放入“字符串”中
  • 在凌乱字段中每行的末尾使用continue字符\

  • 很难重现你的问题,你能提供一个csv文件并给我们一些关于文件编码等的细节吗?顺便问一下,你是否只是尝试使用通用换行模式(“rU”而不是“r”)?