我想在 ping 它之前从文本文档中删除跨度标签,否则它将失败,但我无法让它删除跨度标签并在没有标签的情况下再次保存文件或将新结果保存到数组中保存.
from bs4 import BeautifulSoup
with open(r'sitelist.txt') as f:
f = f.read().splitlines()
soup = BeautifulSoup(f,"html.parser")
while len(soup.find_all('span')) > 0:
soup.span.extract()
f = soup
return f
我试图分解或打开包装,但无法得到我想要的结果。