lxml: traverse xml tree and retrieve element based on an attribute

MRAB google at mrabarnett.plus.com
Fri May 22 02:27:39 CEST 2009


byron wrote:
[snip]
> 
> Thanks. Yes i tried something like this, but I think I overwrite `c`
> when i wrote it, as in:
> 
>     if len(c) > 0:
>         c = fin_node(c, name)
>         if c is not None:
>             return c
> 
FYI, doing that won't actually matter in this case; 'c' will still be
bound to the next value on the next iteration of the loop because it's
just a reference to the iterator and 'assigning' won't affect the
iterator as in soem other languages.



More information about the Python-list mailing list