Permalink
Browse files

Add parsemprakash

  • Loading branch information...
1 parent 514dced commit ce3af0215e419a2ff9df2b1f25efd109a253ec6c @amit committed Apr 17, 2009
Showing with 20 additions and 0 deletions.
  1. +20 −0 parseprakash.py
View
@@ -0,0 +1,20 @@
+# Simple script to aggregate students ranks from different websites
+
+import urllib2
+import csv
+from BeautifulSoup import BeautifulSoup
+
+initials=["A", "B", "C", "D", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "R", "S", "T", "U", "V", "Y"]
+
+urls = ["http://mprakashacademy.co.in/11ResultFiles/%s.htm" % (i.lower()) for i in initials]
+
+resWriter = csv.writer(open('results.csv','w'),lineterminator="\n")
+
+for url in urls:
+ data = urllib2.urlopen(url).read()
+ soup = BeautifulSoup(data)
+ rows=soup.findAll('tr')
+ for row in rows:
+ rr=row.findAll('td')
+ if rr:
+ resWriter.writerow([q.string for q in rr])

0 comments on commit ce3af02

Please sign in to comment.