I just want to fetch port value from cmd_resp.
cmd_resp = '{ "toolkitStruct":{ "access_ctrl":{ "restricted":false, "disabled":false, "port":8001 }, "description":"EdgeX dev UI and API gateway (authenticated)", "label":"EdgeX API Gateway/UI" } }'
output = cmd_resp.split('"port":')[1].split(',')[0]
output = re.sub(r"[\}]", '', output).strip()
My way, I have achieved output = '8001' but can I get the same in more cleaner way? please suggest. Additionally: And what, If need to save {"port":8001}?