【发布时间】:2018-04-22 12:15:29
【问题描述】:
我是 Python 的新手。刚刚为 Windows 安装它并尝试 HTML 抓取。 这是我的测试代码:
from bs4 import BeautifulSoup
html = 'text <a href="Transfert.php?Filename=myfile_x86&version=5¶m=13" class="nav" style="color: #000000" title = "">Download</a> text'
print(html)
soup = BeautifulSoup(html, "html.parser")
for link in soup.find_all('a'):
print(link.get('href'))
此代码返回已收集但损坏的链接:
Transfert.php?Filename=myfile_x86&version=5¶m=13
【问题讨论】:
-
你想要什么输出?
-
没有字符串格式的普通链接文本到符号。
标签: python windows beautifulsoup