python convert string to list of dictionaries