提交 5866a8dc 作者: XveLingKun

政策法规--中央有关文件

上级 5fcdf451
...@@ -48,6 +48,7 @@ def getSoup(url): ...@@ -48,6 +48,7 @@ def getSoup(url):
def getTotal(soup): def getTotal(soup):
total = soup.find('div', class_='news_box').text total = soup.find('div', class_='news_box').text
print(total)
totalPage = re.findall('nPageCount = (\d+);', total)[0] totalPage = re.findall('nPageCount = (\d+);', total)[0]
return int(totalPage) return int(totalPage)
...@@ -97,7 +98,8 @@ def doJob(): ...@@ -97,7 +98,8 @@ def doJob():
flg = False flg = False
url = 'https://www.gov.cn/zhengce/wenjian/zhongyang/home.htm' url = 'https://www.gov.cn/zhengce/wenjian/zhongyang/home.htm'
soup = getSoup(url) soup = getSoup(url)
totalPage = getTotal(soup) # totalPage = getTotal(soup)
totalPage = 1
for i in range(totalPage): for i in range(totalPage):
if flg: if flg:
break break
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论