Parse items from text file

Posted by chris on Stack Overflow See other posts from Stack Overflow or by chris
Published on 2010-06-14T19:07:45Z Indexed on 2010/06/14 19:12 UTC
Read the original article Hit count: 133

Filed under:

I have a text file that includes data inside {[]} tags. What would be the suggested way to parse that data so I can just use the data inside the tags?

Example text file would look like this:

'this is a bunch of text that is not {[really]} useful in any {[way]}. I need to {[get]} some items {[from]} it.'

I would like to end up with 'really', 'way', 'get', 'from' in a list. I guess I could use split to do it.. but seems like there might be a better way out there. I have seen a ton parsing libraries, is there one that would be perfect for what I want to do?

© Stack Overflow or respective owner

Related posts about python