ฉันพยายามเข้าถึงmodel.filefieldใน Django เพื่อแยกวิเคราะห์ไฟล์ CSVใน Python โดยใช้csvโมดูล มันทำงานบน Windows แต่บน Mac มันให้สิ่งนี้แก่ฉัน:
Exception Type: Error
Exception Value: new-line character seen in unquoted field - do you need to open the file in universal-newline mode?
นี่คือรหัส:
myfile = customerbulk.objects.all()[0].fileup
mydata = csv.reader(myfile)
for email,mobile,name,civilid in mydata:
print email,mobile,name,civilid
customerbulk.objects.all()[0].fileupอะไรกัน. เป็นชื่อไฟล์ในโมเดลหรือไม่?