Categories
Python Answers

How to fix CSV new-line character seen in unquoted field error in Python?

Spread the love

Sometimes, we want to fix CSV new-line character seen in unquoted field error in Python.

In this article, we’ll look at how to fix CSV new-line character seen in unquoted field error in Python.

How to fix CSV new-line character seen in unquoted field error in Python?

To fix CSV new-line character seen in unquoted field error in Python, we can call csv.reader with the dialect argument.

For instance, we write

file_read = csv.reader(file, dialect=csv.excel_tab)

to call csv.reader with the CSV file returned from open.

And the dialect argument is set to csv.excel_tab to read it in as a Excel tab delimited CSV.

Conclusion

To fix CSV new-line character seen in unquoted field error in Python, we can call csv.reader with the dialect argument.

By John Au-Yeung

Web developer specializing in React, Vue, and front end development.

Leave a Reply

Your email address will not be published. Required fields are marked *