I have multiple dictionaries which are not separated by commas and type is string, is it possible to separate them and get nice elements in a list, with each element representing a dictionary.
E.g. : what I have: {} {} {}
What I want [{}, {}, {}]
I know its similar to Want to separate list of dictionaries not separated by comma, But i do not want to call subprocess and call sed.
Example:
data = {"key1":"val1", "key2":"val2", "key3":"val3", "key4":"val4"} {"key1":"someval", "key2":"someval", "key3":"someval", "key4":"someval"} {"key1":"someval", "key2":"someval", "key3":"someval", "key4":"someval"}
what i want is :
[{"key1":"val1", "key2":"val2", "key3":"val3", "key4":"val4"} ,
{"key1":"someval", "key2":"someval", "key3":"someval", "key4":"someval"},
{"key1":"someval", "key2":"someval", "key3":"someval", "key4":"someval"}]
How do i achieve this.
Example 2 :
string = '''{"Date1":"2017-02-13T00:00:00.000Z","peerval":"222.22000","PID":109897,"Title":"Prop 1","Temp":5,"Temp Actual":5,"Temp Predicted":3.9,"Level":"Medium","Explaination":"Source: {some data \n some link http:\\www.ggogle\.com with some sepcial characters ">< ?? // {} [] ;;}","creator":"\\etc\\someid","createdtime" :"2017-02-12T15:24:38.380Z"}
{"Date1":"2017-02-13T00:00:00.000Z","peerval":"222.22000","PID":109890,"Title":"Prop 2","Temp":5,"Temp Actual":5,"Temp Predicted":3.9,"Level":"Medium","Explaination":"Source: {some data \n some link http:\\www.ggogle\.com with some sepcial characters ">< ?? // {} [] ;;}","creator":"\\etc\\someid","createdtime" :"2017-02-12T15:24:38.380Z"}
'''
NOTE : each dictionary ends with $(newline)