Masi Masi - 10 months ago 49
Python Question

To build a similar reputation tracker as Jon's by Python

Jon Skeet has the following reputation tracker which is built by C#.

I am interested in building a similar app by Python such that at least the following modules are used

  • beautiful soup

  • defaultdict

We apparently need

How can you build a similar reputation system as Jon's one by Python?


The screenscraping is easy, if I understand the SO HTML format correctly, e.g., to get my rep (as I'm user 95810):

import urllib
import BeautifulSoup
page = urllib.urlopen('')
soup = BeautifulSoup.BeautifulSoup(page)
therep = str(soup.find(text='Reputation').parent.previous.previous).strip()
print int(therep.replace(',',''))

I'm not sure what you want to do with defaultdict here, though -- what further processing do you desire to perform on this int, that would somehow require storing it in a defaultdict?