#!/usr/local/bin/python3 import xml.etree.ElementTree as etree from io import StringIO i = etree.iterparse(StringIO(''), events=('end', 'end-ns')) for e in i: print(e)