请教下 python BeautifulSoup4 取链接
本帖最后由 mingtian 于 2018-4-12 23:20 编辑<article class="am-g">
<div class="am-u-sm-2">
<a href="/book/3033"><img src="http://baidu.com/3/3033/3033s.jpg" alt="魔牌明月" class="am-img-thumbnail am-radius am-list-img am-list-img"> </a>
</div>
<div class="am-list-info am-u-sm-10">
<div class="am-list-info-right">
<a href="/book/3033">
<h3 class="am-list-title am-text-truncate">魔牌明月</h3>
</a>
<span class="am-list-update am-text-truncate">
连载中 </span>
<span class="am-list-author am-text-truncate">
<p>作者: </p><strong>吕南明</strong>
</span>
<div class="am-list-info-p am-list-line-clamp">
---本书已经上架,求订阅,求贵宾,求盖章......谢谢!
</div>
</div>
<div class="am-list-info-last am-text-xs">
<p>最新章节: </p><strong><a href="/read/3033/780137">第五百一十章 完本感言</a></strong>
</div>
</div>
</article>
需要从这里获取到a链接
<a href="/book/3033"><img src="http://baidu.com/3/3033/3033s.jpg" alt="魔牌明月" class="am-img-thumbnail am-radius am-list-img am-list-img"> </a>
也就是获取/book/3033
才接触这个。没看懂。懂的朋友说下 有几种方法取出这个链接
这样取出来 for mulu1 in soup.select('.am-u-sm-2 a')['href']
居然是竖着一行。。
/
b
o
o
k
/
3
0
3
3
就是这样 不知道为啥
大风起 发表于 2018-4-13 19:40
import lxml.html as lh
html = '''
嗯 多谢
才接触的。。慢慢琢磨
页:
[1]