I am parsing a file with lines like
type ("book") title ("golden apples") pages (10-35 70 200-234) comments ("good read")
And I want to break it down into separate fields.
In my example, there are four fields: type, title, pages and comments.
Desired Result After Cleavage
['type ("book")', 'title ("golden apples")', 'pages (10-35 70 200-234)', 'comments ("good read")]
Obviously, simple line splitting will not work, because it will simply be split into each space. I want to break into spaces, but keep something between brackets and quotation marks.
How can I share this?
source
share