CSV new-line character seen in unquoted field error

后端 未结 9 1293
花落未央
花落未央 2020-11-27 14:14

the following code worked until today when I imported from a Windows machine and got this error:

new-line character seen in unquoted field - do you need to o

9条回答
  •  佛祖请我去吃肉
    2020-11-27 14:28

    If this happens to you on mac (as it did to me):

    1. Save the file as CSV (MS-DOS Comma-Separated)
    2. Run the following script

      with open(csv_filename, 'rU') as csvfile:
          csvreader = csv.reader(csvfile)
          for row in csvreader:
              print ', '.join(row)
      

提交回复
热议问题