首页
学习
活动
专区
工具
TVP
发布
社区首页 >问答首页 >怎么使用BeautifulSoup的方法提取href里面的内容?

怎么使用BeautifulSoup的方法提取href里面的内容?

提问于 2020-03-24 17:37:39
回答 0关注 0查看 671
代码语言:javascript
复制
url = "https://service.tp-link.com.cn"
# /detail_download_7539.html
for page in range(1,2):
    get_url = './download?classtip=software&p=1'+str(page)+'&o=0'
    next_url = urllib.parse.urljoin(url,get_url)
    html = requests.get(next_url).text
    bs4 = BeautifulSoup(html,"html.parser")
    for url1 in bs4.find_all(class_="col1"):
        print(url1)

我通过上面这个方法获取了下面一组数据

<th class="col1">名称</th>

<th class="col1"><a href="/detail_download_7353.html">TL-IPC423C(P)-SX V2.0升级软件20191214_1.0.1</a></th>

<th class="col1"><a href="/detail_download_7359.html">TL-WAR1200L V4.0升级软件20191211_1.0.2</a></th>

<th class="col1"><a href="/detail_download_7358.html">TL-FW6300 V1.0升级软件20191214_1.0.1</a></th>

<th class="col1"><a href="/detail_download_7357.html">TL-SL3226P-Combo V4.0升级软件20191111_1.0.1</a></th>

<th class="col1"><a href="/detail_download_7356.html">TL-SL3452-Combo V4.0升级软件20191111_1.0.4</a></th>

<th class="col1"><a href="/detail_download_7355.html">TL-SL5210 V3.0升级软件20191112_1.0.2</a></th>

<th class="col1"><a href="/detail_download_7354.html">TL-SL3210PE V4.0升级软件20191111_1.0.1</a></th>

<th class="col1"><a href="/detail_download_7350.html">TL-IPC534H(P)-WBX V1.0升级软件20191118_1.0.7</a></th>

<th class="col1"><a href="/detail_download_7349.html">TL-IPC43AN-WB4 V1.0升级软件20191203_1.0.4</a></th>

可是我没有办法继续获取到href里面的具体内容,这个应该怎么解决

回答

和开发者交流更多问题细节吧,去 写回答
相关文章

相似问题

相关问答用户
领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档