How to use Python XML findall to find ''

后端 未结 3 1150
爱一瞬间的悲伤
爱一瞬间的悲伤 2020-12-07 04:49

I\'m trying to do a find all from a Word document for with namespace xmlns:v=\"urn:schemas-microsoft-

3条回答
  •  夕颜
    夕颜 (楼主)
    2020-12-07 04:59

    With ElementTree in Python 3.8, you can simply use a wildcard ({*}) for the namespace:

    results = ET.fromstring(xml).findall(".//{*}imagedata") 
    

    Note the .// part, which means that the whole document (all descendants) is searched.

提交回复
热议问题