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

Popular posts from this blog

iphone - Dismissing a UIAlertView -

intellij idea - Update external libraries with intelij and java -

javascript - send data from a new window to previous window in php -