|  | 
 
| 
本帖最后由 Vastsea 于 2020-5-13 08:44 编辑
x
马上注册,结交更多好友,享用更多功能^_^您需要 登录 才可以下载或查看,没有账号?立即注册  
 复制代码import requests
from bs4 import BeautifulSoup
from openpyxl import Workbook
wb = Workbook()
ws = wb.active
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()
count = trs   
ws.title
ws['A1'] = "IP地址"
ws['B1'] = "总数"
for n in count
    ws.append([i,count])
ws.save(""c:\\New folder\\11.xlsx"")
 提示如下错误
 
 File "<ipython-input-4-58c9043a6f9c>", line 19
 for n in count
 ^
 SyntaxError: invalid syntax
 | 
 |