On Apr 20, 2:05 pm, Steve Holden <[EMAIL PROTECTED]> wrote:
<snip>
>
> did you try something like (untested)
>
> cell1, cell2, cell3, cell4, cell5, \
>                 cell6, cell7, cell8 = row.findAll("td")
>
> No need for the "for" if you want to handle each cell differently, you
> won;t be iterating over htem . And, as you saw, it doesn't work unless
> row.findAll(...) returns a sequence of eight-item containers.
>

One defensive approach to handle rows that might have too few or too
many elements, is to construct a larger list, and then slice the right
number of elements from it.

cell1, cell2, cell3, cell4, cell5, \
                cell6, cell7, cell8 = (row.findAll("td") + [None]*8)[:
8]

-- Paul


-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to