一直很喜欢看糗百(比如上厕所时。。。),但是至今还没有注册,因为没有邀请码。。。!!今天用Python的urllib和正则表达式写了一个小程序,抓取糗百上有些好心人发的邀请码,从最新页抓取。感觉实用性不大。。就是省得一行行找码。。。先放在这里吧,有需要的拿去就是了
#coding: utf-8
__author__ = 'bob'
import urllib,re
m = urllib.urlopen('http://www.qiushibaike.com/new2/late').read()
f = ''.join(m)
pattern = re.compile(r'\w{4}\s\w{4}\s\w{4}\s\w{4}')
newest = pattern.findall(f)
print newest