ElementTree.tostring(elem, 'utf-8')
root.append(Element('method', OrderedDict([ ('attr1', 'value1'), ('attr2', 'value2'), ])))
ElementTree.tostring(elem, 'utf-8')
root.append(Element('method', OrderedDict([ ('attr1', 'value1'), ('attr2', 'value2'), ])))
From section 3.1 of the XML recommendation:Интересно, а почему только в корневом или пустом элементе?Note that the order of attribute specifications in a start-tag or empty-element tag is not significant.
odnochlen
Интересно, а почему только в корневом или пустом элементе?
odnochlenНе в корневом, а открывающем. В end-tag вроде вообще нельзя атрибуты писать
Интересно, а почему только в корневом или пустом элементе?
Note that the order of attribute specifications is not significant.т.к. в других тегах атрибутов быть не может?
>>> file("\0") Traceback (most recent call last): File "<stdin>", line 1, in <module> TypeError: file() argument 1 must be encoded string without NULL bytes, not str
TypeError: file() argument 1 may not contain NULL bytes