Progrider

Programming discussion

Board index
Help✓ Resolved

Commas inside quoted CSV fields

Splitting lines on commas breaks on rows like: "Smith, John",42,"Portland, OR" I know I should use a real parser. Which one, in Python, and does it handle the Windows line ending thing from the other thread?

2 replies

The csv module in the standard library. csv.reader handles quotes and embedded commas. Open the file with newline="" for reading too, same reason as writing.
Worked first try. Resolved.

Discussion resolved

This discussion is resolved. Its creator can reopen it to accept more replies.