On Thu, Jun 3, 2010 at 7:21 PM, joblack <johannes.bl...@gmail.com> wrote: > I've got a string which (without any CR or LF) consists of > > 'attribute1=attribute_value;attribute2=attribute_value2; ...' > > and I want them to read in a dictionary so that the attribute name is > the key and the attribute value is the data. > > Any ideas for an implementation? > > Greetings and thanks > jb > --
If you can guarantee that the attributes and values don't have semicolons or equal signs in them, you can just split it for pair in your_string.split(';') : key, value = pair.split('=') your_dict[key] = value -- http://mail.python.org/mailman/listinfo/python-list