Skip to content Skip to sidebar Skip to footer

Unable To Get Correct Link In Beautifulsoup

I'm trying to parse a bit of HTML and I'd like to extract the link that matches a particular pattern. I'm using the find method with a regular expression but it doesn't get me the

Solution 1:

find only returns the first <a> tag. You want findAll.

Solution 2:

Can't answer your question, but anyway your (originally) posted code has an import typo. Change

import BeautifulSoup

to

fromBeautifulSoupimportBeautifulSoup

Then, your output (using beautifulsoup version 3.1.0.1) will be:

http://www.imdb.com/title/tt1196141/

Post a Comment for "Unable To Get Correct Link In Beautifulsoup"