1. Because people can not be endlessly learning, and occasionally want to do something else, yesterday bored to write python, of course, I admit that I work basically is learning work, in this post I also stayed for more than three years, or that sentence asked me what will I give you say I what will, just a matter of time! All right, don't spit out the groove, everyone together refueling! Direct to code and results.
2. Program code:
# Encoding:utf-8
Import re
From Urllib Import Request
Import gzip
def gethtml (URL): #获取页面的源代码
page = Request.urlopen (URL)
html = Page.read ()
HTML = gzip.decompress (HTML)
html = Html.decode (' Utf-8 ')
Regall = R ' <td><b class= "c_ba2636" >.*</b> '
Balllist = Re.findall (regall,html)
For I in Balllist:
num = i[-17:-4]
Print (i[-17:-4])
In_put = open (' d:/crawler/file ', ' a ')
In_put.write (' \ n ')
In_put.write (num)
In_put.close ()
Return num
Print (gethtml (' http://caipiao.163.com/award/qxc/'))
3. Results
FUN, FUN!!!!! Play with Fun python!
Python crawls the seven-color lottery history