internet data handling and encoding the element interface although the elements stored in an elementtree may have varying typesthey all support common interface if elem is any elementthen the following python operators are definedoperator description elem[nelem[nnewelem returns the nth child element of elem changes the nth child element of elem to different element newelem deletes the nth child element of elem number of child elements of elem del elem[nlen(elemall elements have the following basic data attributesattribute description elem tag string identifying the element type for examplehas tag of 'foodata associated with the element usually string containing text between the start and ending tags of an xml element additional data stored with the attribute for xmlthis is usually string containing whitespace found after the element' end tag but before the next tag starts dictionary containing the element attributes elem text elem tail elem attrib elements support the following methodssome of which emulate methods on dictionarieselem append(subelementappends the element subelement to the list of children elem clear(clears all of the data in an element including attributestextand children elem find(pathfinds the first subelement whose type matches path elem findall(pathfinds all subelements whose type matches path returns list or an iterable with the matching elements in document order elem findtext(path [default]finds the text for the first element whose type patches path default is string giving the value to return if there is no match elem get(key [default]gets the value of attribute key default is default value to return if the attribute doesn' exist if xml namespaces are involvedthen key will be string of the form '{uri}key}where uri is string such as ' lib fl ff