I have the following code, and the idea is to be able to iterate over root for each string in some_list[j]. The goal is to stay away from nested for loops and learn a more pythonic way of doing this. I would like to return each value for the first item in some_list then repeat for the next item in some_list.
for i, value in enumerate(root.iter('{0}'.format(some_list[j])))
return value
Any ideas?
EDIT: root is
tree = ElementTree.parse(self._file)
root = tree.getroot()
returnstatement does first. What do you want to do with these values?yield? I would like to push them to another function for further processing.