https://wenku.baidu.com/view/610da44658eef8c75fbfc77da26925c52cc59198.html
import requests
from bs4 import *
pageSize=20
pageIndex=1
while True:
url="http://www.csh.edu.cn/moetc/mdepartmentExtAction!toMdepartmentExtListWdOuter.action?cityId=220100000000&mdepartmentExt.type=4&mdepartmentExt.parentId=220100000000&pageSize="+str(pageSize)+"&pageIndex="+str(pageIndex)
response = requests.post(url)
soup=BeautifulSoup(response.text,'html.parser')
arr1=soup.select('.h_tdListCenter')
arr2=soup.select(".h_tdListCenter1")
for i in range(0,len(arr1)):
schoolname=arr1[i].text.replace('<td class="h_tdListCenter" nowrap="nowrap" width="30%">','').replace('</td>','').replace(" ","")
number=arr2[i].text.replace('<td class="h_tdListCenter1" nowrap="nowrap" width="30%">','').replace('</td>','').replace(" ","")
print(schoolname.strip(),end=" ")
print(number.strip())
if len(arr1)==0:
break
else:
pageIndex=pageIndex+pageSize
抓取国家的学校编码数据
原创superhuanghai ©著作权
©著作权归作者所有:来自51CTO博客作者superhuanghai的原创作品,请联系作者获取转载授权,否则将追究法律责任
上一篇:云平台架构架构调整路线图
下一篇:VBA 学习
提问和评论都可以,用心的回复会被更多人看到
评论
发布评论
相关文章