Using XPath in ElementTree

后端 未结 5 1451
情话喂你
情话喂你 2020-11-30 00:51

My XML file looks like the following:




        
5条回答
  •  北荒
    北荒 (楼主)
    2020-11-30 00:58

    I ended up stripping out the xmlns from the raw xml like that:

    def strip_ns(xml_string):
        return re.sub('xmlns="[^"]+"', '', xml_string)
    

    Obviously be very careful with this, but it worked well for me.

提交回复
热议问题