Advertisement
wandrake

Untitled

Feb 5th, 2014
333
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.99 KB | None | 0 0
  1. def parse_students(course, year, no, exam):
  2.     ret = []
  3.     appellore = re.compile(_appelloptn)
  4.     studentre = re.compile(_studentptn)
  5.     url = "http://compass2.di.unipi.it/didattica/%s/share/orario/Appelli/" % course \
  6.          + "appelliret.asp?letter=&ycourse=&course=%s&year=%d&start=%d&end=%d&chk=%s" % \
  7.          (course, year, no, no, exam)
  8.     h = utils.web.url2html(url)
  9.     matches = appellore.finditer(h)
  10.     try:
  11.         m = matches.next()
  12.     except StopIteration:
  13.         return []
  14.     url = "http://compass2.di.unipi.it/didattica/inf31/share/orario/Appelli/lista.asp?action=list&appello=%s" \
  15.         % m.group(1)
  16.  
  17.     h = utils.web.url2html(url)
  18.     matches = studentre.finditer(h)
  19.     ok = True
  20.     while ok:
  21.         try:
  22.             m = matches.next()
  23.             ret.append([m.group(1), m.group(2), m.group(3), m.group(4)])
  24.             #print m.group(1), m.group(2), m.group(3), "Note:", m.group(4)
  25.         except StopIteration:
  26.             ok = False
  27.  
  28.     return ret
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement