PyXML on Ubuntu

前端 未结 2 1231
被撕碎了的回忆
被撕碎了的回忆 2021-01-22 17:26

I just completed a fresh install of Ubuntu 10.10 and I\'m trying to run some scripts that use xml and xpath. I get an error from inside PyXML.

I think this is an inst

相关标签:
2条回答
  • 2021-01-22 17:54

    Just for the record, if you really need PyXML (i.e. legacy code that you don't have the time to port right now), just changing as in the two places it is used to some other variable name will do.

    Additionally, I noticed that Gentoo added the method use_pyxml() to PyXML which explicitly needs to be called; so the standard library XML modules are not used. See here if that is of interest.

    0 讨论(0)
  • 2021-01-22 18:11

    PyXML should have been written for very old version of Python (< 2.4) and it used one of the later keywords 'as' as its variable. If your requirement is simple, you can just use ElementTree from Python Standard library which has support for XPath expressions. An example is here.

    For using the standard library module, do:

    from xml.etree.ElementTree import ElementTree
    
    0 讨论(0)
提交回复
热议问题