python - Open the file in universal-newline mode using the CSV Django module -
python - Open the file in universal-newline mode using the CSV Django module -
i trying access model.filefield
in django parse csv file in python using csv
module. it's working on windows, on mac gave me this:
exception type: error exception value: new-line character seen in unquoted field - need open file in universal-newline mode?
this code:
myfile = customerbulk.objects.all()[0].fileup mydata = csv.reader(myfile) email,mobile,name,civilid in mydata: print email,mobile,name,civilid
i found solution:
mypath = customerbulk.objects.get(pk=1).fileup.path o = open(mypath,'ru') mydata = csv.reader(o)
python django osx csv newline
Comments
Post a Comment