首页 > 其他 > 详细

爬虫新练习

时间:2018-04-09 12:58:40      阅读:183      评论:0      收藏:0      [点我收藏+]
import requests
import re
from bs4 import BeautifulSoup

url="http://news.gzcc.cn/html/xiaoyuanxinwen/"
res=requests.get(url)
res.encoding="utf-8"

url1="http://oa.gzcc.cn/api.php?op=count&id=9183&modelid=80"
res1=requests.get(url1)
print(res1.text.split(".html")[-1].lstrip("(‘").rstrip("‘);"))

newUrl =‘http://news.gzcc.cn/html/2018/xiaoyuanxinwen_0404/9183.html‘
re1 = re.search(‘\_(.*).html‘,newUrl)
re2 = re.match(‘http://news.gzcc.cn/html/2018/xiaoyuanxinwen_(.*).html‘,newUrl)
print(re1.group(1).split(‘/‘)[-1],re2.group(1).split(‘/‘)[-1])

 

爬虫新练习

原文:https://www.cnblogs.com/lg916843/p/8758677.html

踩
(0)
赞
(0)
   
举报
评论 一句话评论(0)
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!