5 Apr
2018
5 Apr
'18
12:55 a.m.
Hello, Suppose I iterate over the elements of a subtree, then is it safe to remove the elements during the iteration: for elem in t.xpath("br"): p = elem.getparent() p.remove(elem) # _Seems_ to work? or will that mess with the iterator, and I should collect the elements first: for elem in list(t.xpath("br")): # now remove I guess I can rephrase the question: is xpath() lazy? Just want to make sure. Thanks! Jens -- Jens Tröger http://savage.light-speed.de/