Reputation: 39018
following the Python tutorial on Tuts+ and I'm getting a syntax error in my code below:
#!/usr/bin/env python
from bs4 import BeautifulSoup
from urllib import urlopen
html = urlopen('http://www.brainyquote.com/quotes/topics/topic_life.html').read()
soup = BeautifulSoup(html)
for section in soup.findAll('span',{"class":"bqQuoteLink"})
print section
break
The tutorial required me to download and install BeautifulSoup, which I did with no errors. The only thing I can think off is that I'm using 4.3 while the tutorial author used 4.1?
Upvotes: 1
Views: 102
Reputation: 236004
Try this:
for section in soup.findAll('span', {"class":"bqQuoteLink"}):
... You forgot the :
at the end of the loop.
Upvotes: 6