Re: Understanding the arguments for SubElement factory in ElementTree

2005-10-30 Thread Giovanni Bajo
[EMAIL PROTECTED] wrote: > > xyz > > > rather than: > root = Element('root') > subroot = SubElement(root, 'subroot') > subroot.text = 'xyz' > > Was wondering whether this code accomplish that > root = Element('root') > subroot = SubElement(root, 'subroot', text='xyz') No, this creates:

Re: Understanding the arguments for SubElement factory in ElementTree

2005-10-29 Thread B Mahoney
Your SubElement call is lacking the attrib argument, but you can't set text, anyway. The elementtree source makes it clear, you can only set element attrib attributes with SubElement def SubElement(parent, tag, attrib={}, **extra): attrib = attrib.copy() attrib.update(extra) element =