From a large table I want to read rows 5, 10, 15, 20 ... using BeautifulSoup. How do I do this? Is findNextSibling and an incrementing counter the way to go?
Another option, if you prefer raw html...
"""Build a small table with one column and ten rows, then parse it into a list"""
htstring = """ foo1 foo2 foo3 foo4 foo5 foo6 foo7 foo8 foo9 foo10
"""
result = [html_tr for idx, html_tr in enumerate(soup.findAll('tr')) \
if (idx+1)%5==0]
print result
Running that...
[mpenning@Bucksnort ~]$ python testme.py
[ foo5 , foo10 ]
[mpenning@Bucksnort ~]$