查看单个帖子
HappyDragon
 
HappyDragon 的头像
核心会员
 
资 料:
注册日期: Jul 2003
帖子: 3,677 声望值: 3
精华: 0,解答: 3
#9 旧 2020-05-05, 14:04:57 默认
HappyDragon 当前离线  

代码:
import requests
from bs4 import BeautifulSoup
ip = ['10.0.3.12','10.0.55.20','10.0.3.18','10.0.70.18','10.0.3.15','10.0.70.24']
for i in ip:
    url = "http://" & i & "/web/guest/cn/websys/status/getUnificationCounter.cgi"
        
req = requests.get(url)
html = req.text
bs = BeautifulSoup(html,"html.parser")
trs = bs.select('tr.staticProp')[1].get_text()
trs 输出的结果为“总数:XXXXX”

想要输出结果为:

10.0.3.12 总数:XXXXX
10.0.55.20 总数:XXXXX
10.0.3.18 总数:XXXXX
10.0.70.18 总数:XXXXX
......


君子博学而日参省乎己,则知明而行无过矣。
回复时引用此帖