#!/usr/local/bin/python2 import xml.etree.ElementTree as ET e = ET.fromstring('') print e[tuple(e).index(e[-1])] print len(e)