on-internet
← Community

Cannot correctly parse a CSV delimited by commas, but containing a header, and with fields surrounded by double quotes, but which also contain commas

Stack Overflow ·

I've had a search around, and found some solutions which should work, but for some reason just aren't working for me. Here is the sample CSV i'm working with: "Org. Code","Hubspot Ref","Company Name","Contact First Name","Contact Last Name","Job Title","Address","City","Phone","Email","Last Update" "2h34h234h","12345678","A Random Company","John","Smith","Developer","300 PARK AVE SOUTH, 4TH FL","NEW YORK","+123456789","[email protected]","10/03/2016 12:00" I'm trying to parse it with this snippet of code: with open(os.path.basename(theCSV),"r") as f: reader = csv.reader(f) data = list(read

Comments

Sign in or sign up to comment and upvote.

No comments yet.