That is, all text and subtags, without the tag of an element itself?
Having
blah bleh blih
I
This answer is slightly modified of Pupeno's reply. Here I added encoding type into "tostring". This issue took many hours of mine. I hope this small correction will help others.
def element_to_string(element):
s = element.text or ""
for sub_element in element:
s += ElementTree.tostring(sub_element, encoding='unicode')
s += element.tail
return s