I have a file containing several entries. Each entry has the following form:
"field1","field2","field3","field4","field5"
All fields, as a rule, do not contain quotes, however they may contain,. The problem is that field4 can be split across multiple lines. Thus, an example file might look like this:
"john","male US","done","Some sample text across multiple lines. There can be many lines of this","foo bar baz" "jane","female UK","done","fields can have , in them","abc xyz"
I want to extract fields using Python. If the field were not divided into several lines, it would be simple: Extract the line from quotes . But I cannot find an easy way to do this in the presence of multi-line fields.
EDIT: Actually five fields. Sorry about the confusion, if any. The question has been edited to reflect this.
source share