作者LaughPoint (脚步)
看板Python
标题[问题] 爬虫抓不到href
时间Thu Jul 27 17:30:39 2017
在练习爬虫时候
1.
http://i.imgur.com/USkpOq4.png
以上我抓不到a的href,连a都抓不到
2.
但如果我把整段a单独独立成一段去抓,就可以抓的到
http://i.imgur.com/ur4FJTG.png
抓头抓破头,想不到第一段的内文到底出了甚麽问题?
--
※ 发信站: 批踢踢实业坊(ptt.cc), 来自: 60.249.203.175
※ 文章网址: https://webptt.com/cn.aspx?n=bbs/Python/M.1501147841.A.FF2.html
1F:推 Conjuror: 把它改成 i.get('href') 应该就可以印出东西了 07/27 18:02
2F:→ LaughPoint: 谢谢 07/27 19:34
3F:→ coeric: i.find('a') 改成i.a即可 07/27 22:59