V2EX = way to explore
V2EX 是一个关于分享和探索的地方
Sign Up Now
For Existing Member  Sign In
LINAICAI
V2EX  ›  问与答

关于爬虫的问题

  •  
  •   LINAICAI · Jan 4, 2015 · 2765 views
    This topic created in 4131 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
        1
    xiaoqiao  
       Jan 4, 2015   ❤️ 1
    innerHTML?p.text?
    no13bus
        2
    no13bus  
       Jan 4, 2015   ❤️ 1
    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
        3
    icedx  
       Jan 4, 2015 via Android   ❤️ 1
    .text
    LINAICAI
        4
    LINAICAI  
    OP
       Jan 4, 2015
    @no13bus 外面还有好几层<div></div>
    另外页面我要取的不止一行XXX
    LINAICAI
        5
    LINAICAI  
    OP
       Jan 4, 2015
    @no13bus 从一个页面去内容 肯定不止这么一点text 啊 怎么筛选<img align="left" 并且取XXX
    bertonzh
        6
    bertonzh  
       Jan 5, 2015
    $('img[align=left]').parent().text()
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   1201 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 49ms · UTC 17:58 · PVG 01:58 · LAX 10:58 · JFK 13:58
    ♥ Do have faith in what you're doing.