Playing with Beautiful Soup

I've been wanting to play with BeautifulSoup for quite a while now but haven't really had a reason to parse any web pages. But while taking a look at my highly unscientific and probably heavily biased( most of my traffic seems to be coming from language specific sub-reddits ) "What's your favorite Scripting Language" Poll, I thought "Wouldn't it be cool to try to pull this data and plot it in python?"  A perfect excuse to play with BeautifulSoup and pandas.  

There wasn't really any reason to use pandas, I could have plotted it just as easily with matplotlib, but I like pandas.

In [1]:
from bs4 import BeautifulSoup
import requests
import pandas
In [2]:
soup = BeautifulSoup(requests.get('').text, 'html.parser')
In [3]:
polls = soup.find('div', {'class':'poll'})
In [4]:
data = {}
name = ''
for poll in polls():
    if 'text' in poll['class']:
        name = poll.string
    elif 'percent' in poll['class']:
        s = poll.string
        # we need to strip out all but the number of votes
        data[name] = int(s[s.find("(") + 1:s.find(")") - 5])
In [5]:
data = pandas.DataFrame.from_dict(data, orient="index")
<matplotlib.axes.AxesSubplot at 0x479fa30>