LINAICAI
V2EX  ›  问与答

关于爬虫的问题

  •  
  •   LINAICAI · Jan 4, 2015 · 3132 views
    This topic created in 4327 days ago, the information mentioned may be changed or developed.
    <p><img align="left" height="268" src="images/n_shiye.gif" width="151"/>XXX</p>

    想知道BeautifulSoup的话,怎么获取XXX,试过几个方法都得不到~
    6 replies  •  2015-01-05 09:51:02 +08:00
    xiaoqiao
    xiaoqiao
    Jan 4, 2015❤️1
    1
    innerHTML?p.text?
    no13bus
    no13bus
    Jan 4, 2015❤️1
    2
    from bs4 import BeautifulSoup
    aa='''<p><img align="left" height="268" src="images/n_shiye.gif" width="151"/>XXX</p>'''
    b = BeautifulSoup(aa)
    print b.text
    icedx
    icedx
    Jan 4, 2015 via Android❤️1
    3
    .text
    LINAICAI
    LINAICAI
    OP
    Jan 4, 2015
    4
    @no13bus 外面还有好几层<div></div>
    另外页面我要取的不止一行XXX
    LINAICAI
    LINAICAI
    OP
    Jan 4, 2015
    5
    @no13bus 从一个页面去内容 肯定不止这么一点text 啊 怎么筛选<img align="left" 并且取XXX
    bertonzh
    bertonzh
    Jan 5, 2015
    6
    $('img[align=left]').parent().text()
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Privacy   ·   Solana   ·   1124 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 37ms · UTC 23:20 · PVG 07:20 · LAX 15:20 · JFK 18:20
    ♥ Do have faith in what you're doing.