• Register
0 votes
622 views

Probem :

I am getting bellow error

new-line character seen in unquoted field - do you need to open the file in universal-newline mode?

6 5 3
6,930 points

Please log in or register to answer this question.

1 Answer

0 votes

Solution :

I had faced the same issue on my MAC, i followed bellow steps to resolve the issue. 

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

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

Further Readings:

9 7 4
38,600 points

Related questions

0 votes
1 answer 3 views
3 views
Problem: how i can move on in dealing with this situation ? Iterator should return strings, not bytes (did you open the file in text mode?.
asked 1 day ago Wafa Abu Yousef 2.3k points
0 votes
1 answer 2.6K views
2.6K views
Problem : MySample.csv contains the below details : NAME Id No Dept Tommy 1 12 CS Jimmy 2 35 EC Bonny 3 21 IT Franky 4 61 EE And my Python file contains the below code : import csv myifile = open('mysample.csv', "rb") read = csv.reader(myifile) for row in read : ... in for row in read : _csv.Error: iterator should return strings, not bytes (did you open the file in text mode?) How should I fix it?
asked Jan 2, 2020 alecxe 7.5k points
0 votes
1 answer 1.3K views
1.3K views
Problem : When I run my Python code I get the following exception: _csv.error: iterator should return strings, not bytes (did you open the file in text mode?)
asked Nov 18, 2019 peterlaw 6.9k points
0 votes
1 answer 26 views
26 views
Problem: I am a beginner to python and am at the moment having trouble using the command line. I have a script test.py (which only contains print("Hello.")), and it is located in the map C:\Python27. In my system variables, I have specified python to be C:\Python27 (I ... test.py in the command line, but when I do so I get this: File "<stdin>", line 1 python test.py ^ SyntaxError: invalid syntax
asked Jan 9 Mashhoodch 11.4k points
0 votes
1 answer 1.7K views
1.7K views
I was creating a new project in django. Firstly I installed django in my system but when I run the command : python manage.py runserver It does not work It shows a message : python: can't open file 'manage.py': [Errno 2] No such file or directory ... django and I started a project by running the command : django-admin startproject Utility Why am I seeing this error message, do anyone know?
asked Mar 18, 2020 LizzyM 6.1k points
0 votes
1 answer 384 views
384 views
Problem : I am very new to the R, and after researching my error as below extensively, I am still unable to find the fix for it. I have already checked my working directory, and also made sure that the files are in a correct directory. Error in file(file, "rt") : ... sulfate", 1:10) In addition: Warning message: In file(file, "rt") : cannot open file './specdata001.csv': No such file or directory
asked Jan 4, 2020 alecxe 7.5k points
0 votes
1 answer 55 views
55 views
Problem: I'm trying to write a program that looks at a .CSV file (input.csv) and rewrites only the rows that begin with a certain element (corrected.csv), as listed in a text file (output.txt). This is what my program looks like right now: import csv lines = [] ... reader: if row[0] not in lines: writer.writerow(row) Unfortunately, I keep getting this error, and I have no clue what it's about.
asked Feb 19 Mashhoodch 11.4k points
0 votes
1 answer 32 views
32 views
Problem: How Open CSV file using FileReader object? How Create BufferedReader from FileReader? How Read file line by line using readLine() method?
asked Nov 6, 2020 Mashhoodch 11.4k points
0 votes
1 answer 13 views
13 views
Problem: I want to read csv file by using c++ so here is my code int main(){ ifstream classFile("class.csv"); vector<string> classData; while (getline(classFile, line,',')) // there is input overload classfile { classData.push_back(line); } } here is my question ... +/ Library / John is there anyway that I can separate my last column from first of next row? Thank you and sorry that it is confusing
asked Dec 26, 2020 Mashhoodch 11.4k points
0 votes
1 answer 824 views
824 views
Problem : I wanted to read all the csv files from my folder and after that concatenate them to create a big csv file. The structure of all my files was the same, After concatenating I want to save it and read it again. All this was done by me using Pandas. But I ... --> 3 l = list(csvreader) Error: new-line character seen in unquoted field - do you need to open the file in universal-newline mode?
asked Dec 3, 2019 alecxe 7.5k points