Reading from CSV: delimiter must be a string, not unicode

后端 未结 2 1014
灰色年华
灰色年华 2020-12-19 04:01

I had a working routine (after a few helpful folks gave me some critical advice in this thread) creating model instances from a CSV file. Up to now I have been using Python

2条回答
  •  爱一瞬间的悲伤
    2020-12-19 04:27

    Your default encoding is probably not the most appropriate.

    Specify the encoding like this :

    dataReader = csv.reader(open(filename), delimiter=str(u';').encode('utf-8'), quotechar=str(u'"').encode('utf-8'))
    

提交回复
热议问题