Question

I have this piece of html:

<a href="http://francetv.fr/videos/alcaline_l_instant_,12163184.html"  class="ss-titre">
                                "Paris Combo"                   </a>    
<a href="http://francetv.fr/videos/jt20h_,12185324.html" class="ss-titre"> 
                            Journal         </a>

I can get http://francetv.fr/videos/jt20h_,12185324.html (example, not the real adress) but now, I would like, using beautifulsoup, to get "Paris Combo", and "Journal". I tried this:

for line in soup.findAll('/a'):
              title = line.get('</a>')

How can I do? Thanks

Was it helpful?

Solution

You need to call find_all("a") instead.

>>> for line in soup.find_all("a"):
...     print(line.text.strip())
"Paris Combo"
Journal
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top