I am trying to create a dictionary from a list of strings. My attempt to convert this list of string to list of dictionary is as below:
author_dict = [[dict(map(str.strip, s.split(':')) for s in author_transform.split(','))] for author_transform in list_of_strings]
Everything was working fine until I encountered this piece of string:
[[country:United States,affiliation:University of Maryland, Baltimore County,name:tim oates,id:2217452330,gridid:grid.266673.0,affiliationid:79272384,order:2],........,[]]
As this string has an extra comma(,) in the middle of the intended value of affiliation key: my list is getting a spit at the wrong place. Is there a way (or idea) I can use to avoid this kind of situation? If it is not possible, any suggestions on how can I ignore thiskind of list?