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