Unconfirmed and a little rude, but "works" on your example
import re from ast import literal_eval input_string = """ [{webmachine, [ {bind_address, "12.34.56.78"}, {port, 12345}, {document_root, "foo/bar"} ]}] """
Then you can βcollapseβ the list of dictionaries into a simple dict , for example:
dict(d.items()[0] for d in res[0]['webmachine']) {'bind_address': '12.34.56.78', 'port': 12345, 'document_root': 'foo/bar'}
source share