{"Mode":"Handle","FinishPartsNum":0,"Hold":0,"Axis1":610,"Axis2":1050,"Axis3":850,"Axis4":500,"Axis5":550}把里面的每个元素提取出来
时间: 2023-07-08 19:53:20 浏览: 105
参数的提取
可以使用 JSON 解析库来解析该 JSON 字符串,例如使用 Python 的 `json` 模块:
```python
import json
json_str = '{"Mode":"Handle","FinishPartsNum":0,"Hold":0,"Axis1":610,"Axis2":1050,"Axis3":850,"Axis4":500,"Axis5":550}'
data = json.loads(json_str)
mode = data['Mode']
finish_parts_num = data['FinishPartsNum']
hold = data['Hold']
axis1 = data['Axis1']
axis2 = data['Axis2']
axis3 = data['Axis3']
axis4 = data['Axis4']
axis5 = data['Axis5']
print(mode, finish_parts_num, hold, axis1, axis2, axis3, axis4, axis5)
```
输出结果为:
```
Handle 0 0 610 1050 850 500 550
```
这样就能将 JSON 字符串中的每个元素提取出来了。
阅读全文