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

byron bjruth at gmail.com
Fri May 22 02:41:32 CEST 2009


On May 21, 8:27 pm, MRAB <goo... at mrabarnett.plus.com> wrote:
> 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.

Good to know. Thanks.



More information about the Python-list mailing list