generator no iter - how do I call it from another function
Gregory Ewing
greg.ewing at canterbury.ac.nz
Sat Oct 1 20:55:30 EDT 2016
Sayth Renshaw wrote:
> def dataAttr(roots):
> """Get the root object and iter items."""
> with open("output/first2.csv", 'w', newline='') as csvf:
> race_writer = csv.writer(csvf, delimiter=',')
> for meet in roots.iter("meeting"):
The value of roots you're passing in here is a generator
object that yields root instances, not a root instance itself.
So it looks like you need another level of iteration:
for root in roots:
for meet in root.iter("meeting"):
...
--
Greg
More information about the Python-list
mailing list