I want to set namespace for attribute in ElementTree to get following result.
<test xmlns:ns="test"><test1 ns:name="item1" /></test>
I already registered namespaces. But, How should I change the following?
test1 = ET.SubElement(test, "test1", name="item1")
Thanks for any help.
You have to
.set()the attribute:Output: