#!/usr/local/bin/python2 import xml.etree.ElementTree as et r = et.XML('ahhnfh') for i in xrange(100000): ''.join(c.tail for c in r if c.tail is not None) print ''.join(c.tail for c in r if c.tail is not None)