I'm working on a web scraper and it has many different variables so keeping each variable to a single line is important to me. The current variable I am working on I have down to this:
<a href="http://website.com/example/123" target="_blank">Example</a>
Is there any simple way I can simply get the website (http://website.com/example/123
in this case) scrapped out in one line of code?
I'm currently using urllib, re, and BeautifulSoup so any of those libraries are fine. I tried adding
.find('a', attrs={'href': re.compile("^http://")})
to the end of my line, but it made the output return nothing.