Re: beautifulSoup 4.1

2015-04-04 Thread Joe Farro
Could use zip: tds = iter(soup('td')) for abbr, defn in zip(tds, tds): print abbr.get_text(), defn.get_text() -- https://mail.python.org/mailman/listinfo/python-list

Re: beautifulSoup 4.1

2015-03-20 Thread Sayth
Thanks. I couldn't get that second text out. You can use the simpler css class selector I used before in bs4 after 4.1 . The longer version was used to overcome class clashing with the reserved keyword in previous versions. -- https://mail.python.org/mailman/listinfo/python-list

Re: beautifulSoup 4.1

2015-03-20 Thread Denis McMahon
On Fri, 20 Mar 2015 00:18:33 -0700, Sayth Renshaw wrote: > Just finding it odd that the next sibling is a "\n" and not the next > otherwise that would be the perfect solution. Whitespace between elements creates a node in the parsed document. This is correct, because whitespace between elements

Re: beautifulSoup 4.1

2015-03-20 Thread Denis McMahon
On Fri, 20 Mar 2015 07:23:22 +, Denis McMahon wrote: > print td.get_text(), td.find_next_sibling().get_text() A slightly better solution might even be: print td.get_text(), td.find_next_sibling("td").get_text() -- Denis McMahon, denismfmcma...@gmail.com -- https://mail.python.org/mail

Re: beautifulSoup 4.1

2015-03-20 Thread Denis McMahon
On Thu, 19 Mar 2015 21:20:30 -0700, Sayth Renshaw wrote: > But how can I get the value of the following td # find all tds with a class attribute of "abbreviation" abbtds = soup.find_all("td", attrs={"class": "abbreviation"}) # display the text of each abbtd with the text of the next td for td

Re: beautifulSoup 4.1

2015-03-20 Thread Sayth Renshaw
On Friday, 20 March 2015 15:20:41 UTC+11, Sayth Renshaw wrote: > HI > > Probably very easy question. > > If I have a section of html. > > > App > Approaching > D/N > Did nothing > DGO > Didn't go on > DRO > Didn't run on > H/In > Hung in > H/Out > Hung out > > > I can easily get the class va

beautifulSoup 4.1

2015-03-19 Thread Sayth Renshaw
HI Probably very easy question. If I have a section of html. App Approaching D/N Did nothing DGO Didn't go on DRO Didn't run on H/In Hung in H/Out Hung out I can easily get the class values out. In [69]: soup.find_all("td", class_="abbreviation") Out[69]: [App, D/N, DGO, DRO, H/In, H/Ou