Possible duplicate:
How to read CSV string using ??
I saw a number of related questions, but no one directly addressed what I was trying to do. I am reading lines of text from a CSV file.
All items are in quotation marks, and some have extra commas in quotation marks. I would like to split the line along the commas, but ignore the commas in quotation marks. Is there a way to do this in Python that does not require multiple regex statements.
Example:
"114111","Planes,Trains,and Automobiles","50","BOOK"
which I would like to analyze for 4 separate value variables:
"114111" "Planes,Trains,and Automobiles" "50" "Book"
Is there a simple parameter in line.split() that I am missing?
python csv
chrisfs
source share