@@ -0,0 +1,913 @@
+#! /usr/bin/python2.7%0A# -*- coding: utf-8 -*-%0A%0Aimport html5lib%0A%0Adef get_webpage(f):%0A    page = html5lib.HTMLParser(%5C%0A        tree=html5lib.treebuilders.getTreeBuilder(%22lxml%22),%5C%0A        namespaceHTMLElements=False)%0A    p = page.parse(f)%0A    return p%0A%0Adef get_elements(p, x):%0A    elems = p.xpath(x)%0A    e = %5Blist(elem.itertext()) for elem in elems%5D%0A    return e%0A%0Adef get_text(inf, x):%0A    with open(inf, 'r') as f:%0A        p = get_webpage(f)%0A        e = get_elements(p, x)%0A    return %5B'%22%25s%22,%22%25s%22,%22%22,%22%22' %25 (i%5B1%5D, i%5B3%5D.strip()) for i in e%5B1:%5D%5D%0A%0Aif __name__=='__main__':%0A%0A    directory = 'html'%0A    npage = 126%0A    outf = 'data.csv'%0A    x = '//table%5B@class=%22cboard%22%5D//tr'%0A%0A    with open(outf, 'a') as f:%0A        for i in range(1, npage+1):%0A            inf = '%25s/%25s.html' %25 (directory, i)%0A            f.write('%5Cn'.join(get_text(inf, x)).encode('utf-8'))%0A            f.write('%5Cn')%0A            print '%25s/%25s' %25 (i, npage)%0A

Add parser