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

java - How to pass parameters between Request-Scoped Controllers? -

actionscript 3 - Flex: moving a point with rotation doesnt change the point XY? -

string - what is the difference between "some" == "some\0" and strcmp("some","some\0") in c++? -