1.因为人不可能一直无休止的学习,偶尔也想做点儿别的,昨天无聊就想写写Python,当然我承认我上班后基本都是在学工作方面的事情,在这个岗位我也呆了三年多了,还是那句话问我什么会不会我会给你说我啥都会,只是时间问题!好了不吐槽了,大家一起加油!直接给代码和结果。

2.程序代码:

# 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:/爬虫/file', 'a')
in_put.write('\n')
in_put.write(str(num))
in_put.close()
return num
print(getHtml('http://caipiao.163.com/award/qxc/'))
3.结果

python爬取七星彩的开奖历史记录

python爬取七星彩的开奖历史记录

 

好不好玩,好玩!!!!!好玩就一起玩Python!

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-07-31
  • 2021-11-28
  • 2021-10-24
  • 2021-06-29
  • 2022-12-23
猜你喜欢
  • 2021-05-22
  • 2022-12-23
  • 2021-10-11
  • 2021-03-28
  • 2022-01-07
  • 2021-07-18
  • 2021-12-06
相关资源
相似解决方案