使用Python处理CSV中的新行字符

我试图上传一个CSV文件到一个SQL Server数据库使用python.I无法处理新行字符。该文件行为不同在MS Excel和Noptepad ++

以下是包含新行字符的CSV文件的示例。该文件在记事本++中看起来像这样 这个
但在excel中看起来像这样 这个

文本分成C栏两部分

我试图处理这样的换行符

wfile = open(UploadFile, "rU") reader = csv.reader(wfile,delimiter = ",",dialect='excel') with open(UploadFile, "r") as uploadData: formatter_string = "%d/%m/%y %H:%M" for row in reader: datetime_object = datetime.strptime(row[9], formatter_string) row[9] = str(datetime_object.date()) cursor.execute("insert into "+UploadTable+" values ("+(row[9])+","+(row[0])+","+(row[1])+","+(row[2])+","+(row[8])+","+(row[3])+","+(row[4])+","+(row[5])+","+(row[6])+","+(row[7])+")") 

我在这里阅读这个当我试图上传这个文件时,我得到了这个错误

 Failed to upload Facebook data. list index out of range 

我不确定发生了什么问题。

堆栈跟踪:

 Traceback (most recent call last): File "G:/P/14. Digital metrics - Phase 2/3. Execution/4. Code/Code Final/Unmetric Post level/test.py", line 66, in <module> FBPostupload(os.getcwd()+'\FB_Unm_postlevel_camp_mapping.csv','Unm_Fb_Posts_Stage1_test') File "G:/P/14. Digital metrics - Phase 2/3. Execution/4. Code/Code Final/Unmetric Post level/test.py", line 53, in FBPostupload datetime_object = datetime.strptime(row[9], formatter_string) IndexError: list index out of range