lxml question -- creating an etree.Element attribute with ':' in the name

Roy Smith roy at panix.com
Wed Sep 18 14:59:19 EDT 2013


I can create an Element with a 'foo' attribute by doing:

etree.Element('my_node_name', foo="spam")

But, how do I handle something like:

xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance", since "xmlns:xsi" isn't a valid python identifier?

---
Roy Smith
roy at panix.com






More information about the Python-list mailing list