On Wed, Feb 18, 2015 at 3:07 PM,  <kai.pet...@gmail.com> wrote:
> Given
>
> data = '{[<a=14^b=Fred^c=45.22^><a=22^b=Joe^><a=17^c=3.20^>][<a=72^b=Soup^>]}'
>
> How can I efficiently get dictionaries for each of the data blocks framed by 
> <> ?
>
> Thanks for any help

The question here is: What _can't_ happen? For instance, what happens
if Fred's name contains a greater-than symbol, or a caret?

If those absolutely cannot happen, your parser can be fairly
straight-forward. Just put together some basic splitting (maybe a
regex), and then split on the caret inside that. Otherwise, you may
need a more stateful parser.

ChrisA
-- 
https://mail.python.org/mailman/listinfo/python-list

Reply via email to