ElementTree find returns None even without xmlns

前端 未结 1 985
离开以前
离开以前 2021-01-25 08:01

I am trying to replace some values in XML using ElementsTree without xmlns in Python 2.7.5 but it always returns None, no matter what.

Here is my truncated.xml:

相关标签:
1条回答
  • 2021-01-25 09:07

    When you build the tree the context is already definition. Try taking definition/ off the front of your xpath...

    tree.find('scm/userRemoteConfigs/hudson.plugins.git.UserRemoteConfig/url')
    
    0 讨论(0)
提交回复
热议问题