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?
Your discussion
This browser holds the management token for this post.
Save management token
Keep this private. Anyone with the token can resolve or delete this discussion.
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.