| Store | Cart

Understanding the arguments for SubElement factory in ElementTree

From: mirandacascade@yahoo.com <mira...@yahoo.com>
28 Oct 2005 23:39:34 -0700
Can the **extra argument in the SubElement() factory in ElementTree be
used to set the text property? Example:

Want the text associated with the <subroot> tag to be xyz.

<root>
  <subroot>xyz</subroot>
</root>

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')

Recent Messages in this Thread
mira...@yahoo.com Oct 29, 2005 06:39 am
B Mahoney Oct 29, 2005 06:08 pm
Giovanni Bajo Oct 30, 2005 07:12 pm
Messages in this thread

Previous post: Debugging with SciTE
Next post: Scanning a file