I'm using an example I found that extracts links from an webpage
from BeautifulSoup import BeautifulSoup
import urllib2
import re
html_page = urllib2.urlopen("http://arstechnica.com")
soup = BeautifulSoup(html_page)
for link in soup.findAll('a', attrs={'href': re.compile("^http://")}):
print link.get('href')
I get:
File "html_test.py", line 9
print link.get('href')
^
SyntaxError: invalid syntax
I've installed BeautifulSoup with pip to no success.