I write a program using just like below
from xml.etree.ElementTree import ET
xmlroot = ET.fromstring([my xml content])
for element in xmlroot.iterfind(".//mytag"):
do some thing
it works fine on my python (v2.7.1), but after I copy it to another computer installed with python v2.6.x, iterfind()
is not supported, on python document, below description listed
findall(match)
Finds all matching subelements, by tag name or path. Returns a list containing all matching elements in document order.
iterfind(match)
Finds all matching subelements, by tag name or path. Returns an iterable yielding all matching elements in document order.
New in version 2.7.
my question is: these 2 function is same or not? what's difference between these two functions
findall(...)
is implemented usinglist(iterfind(...))
. (At least in Python 3.5) – Schoolbag