code: def get_sector(symbol):
      '''
      Uses BeautifulSoup to scrape stock sector from Yahoo! Finance website
      '''
      url = 'http://finance.yahoo.com/q/pr?s=%s+Profile' % symbol
      soup = BeautifulSoup(urlopen(url).read())
      try:
          sector = soup.find('td', text='Sector:').\
              find_next_sibling().string.encode('utf-8')
      except:
          sector = ''
      return sectof get_sector(symbol):
      '''
      Uses BeautifulSoup to scrape stock sector from Yahoo! Finance website
      '''
      url = 'http://finance.yahoo.com/q/pr?s=%s+Profile' % symbol
      soup = BeautifulSoup(urlopen(url).read())
      try:
          sector = soup.find('td', text='Sector:').\
              find_next_sibling().string.encode('utf-8')
      except:
          sector = ''
      return sector
docs: Uses BeautifulSoup to scrape stock sector from Yahoo! Finance website