Python - How to parse xml response and store a elements value in a variable?
问题 enter code here I am getting the XML response from the API call. I need the "testId" attribute value from this response, Please help me on this. r=requests.get( myconfig.URL_webpagetest + "?url=" + testurl + "&f=xml&k=" + myconfig.apikey_webpagetest ) xmltxt=r.content print (xmltxt) testId = XML (xmltxt).find("testId").text r=requests.get("http://www.webpagetest.org/testStatus.php?f=xml&test=" + testId ) xml response - <?xml version="1.0" encoding="UTF-8"?> <response> <statusCode>200<