我有来自TCP线的数据作为字典列表.但有时我会一次收到两个数据包.他们看着像是
[{"property1":"value1", "property2":"value2"}, {"property1":"value1", "property2":"value2"}][{"property1":"value1", "property2":"value2"}][{"property1":"value1", "property2":"value2"}, {"property1":"value1", "property2":"value2"}]
Run Code Online (Sandbox Code Playgroud)
我想把它转换成这个: -
[{"property1":"value1", "property2":"value2"}, {"property1":"value1", "property2":"value2"}, {"property1":"value1", "property2":"value2"},
{"property1":"value1", "property2":"value2"}, {"property1":"value1", "property2":"value2"}]
Run Code Online (Sandbox Code Playgroud) 我有一个看起来像的字符串.
"[{'P_Key': 'val1', 'Price': '3.95'}, {'P_Key': 'val2', 'Price': '2.2'}, {'P_Key': 'val3', 'Price': '0.4'}]"
Run Code Online (Sandbox Code Playgroud)
我想将其转换为字典列表,如:
[{'P_Key': 'val1', 'Price': '3.95'},
{'P_Key': 'val2', 'Price': '2.2'},
{'P_Key': 'val3', 'Price': '0.4'}]
Run Code Online (Sandbox Code Playgroud)
字符串中可能有任意数量的此类字典.