Stripping python namespace attributes from an lxml.objectify.ObjectifiedElement [duplicate]
问题 This question already has answers here : Closed 7 years ago . Possible Duplicate: When using lxml, can the XML be rendered without namespace attributes? How can I strip the python attributes from an lxml.objectify.ObjectifiedElement ? Example: In [1]: from lxml import etree, objectify In [2]: foo = objectify.Element("foo") In [3]: foo.bar = "hi" In [4]: foo.baz = 1 In [5]: foo.fritz = None In [6]: print etree.tostring(foo, pretty_print=True) <foo xmlns:py="http://codespeak.net/lxml/objectify