开发者社区> 问答> 正文

下面一段html代码怎么用Python+正则一次性提取出来:标题,url,时间,简介组成一个字典?

    <div class="list_item clearfix">
        <div class="item_top">
            <h2><a href="http://money.163.com/15/0902/09/B2GEL9V8002551G6.html">主营业务负增长 董明珠还自信?</a></h2>
                            <a href="http://money.163.com/15/0902/09/B2GEL9V8002551G6.html" title="主营业务负增长 董明珠还自信?" class="newsimg" lang="http://img1.cache.netease.com/stock/2015/9/2/2015090209124874ceb_550.jpg"><img src="http://s.cimg.163.com/stock/2015/9/2/2015090209124874ceb_550.jpg.119x83.jpg" alt="主营业务负增长 董明珠还自信?" /></a>                                <p>[摘要:8月30日晚间公布的格力电器上半年财报无疑给董明珠浇了一盆冷水。虽然董明珠嘴上仍在硬撑,但她的底气明显不足了。因为,格力的主营业务——空调出问题了。当格力开始不谈承诺的时候,董明珠最应该干的事,是静下心来好好反思,而不是把更多的心思花在无聊的口水战和吹牛逼 ...<br />
                <span class="time">2015-09-02 09:20:55</span>
            </p>
        </div>
        <div class="item_bottom">
            <ul class="mod_list">
                <li>董明珠应该静下心好好反思,而不是把心思花在口水战和吹牛逼上。</li>                                                            <li><a href="http://money.163.com/15/0902/09/B2GEL9V8002551G6.html">主营业务负增长 董明珠还自信?</a></li>                </ul>
        </div>
    </div>
                       <div class="list_item clearfix">
        <div class="item_top">
            <h2><a href="http://money.163.com/15/0831/11/B2BGVVQ0002551G6.html">中国手机的非洲历险记</a></h2>
                            <a href="http://money.163.com/15/0831/11/B2BGVVQ0002551G6.html" title="中国手机的非洲历险记" class="newsimg" lang="http://img4.cache.netease.com/stock/2015/8/31/201508311110060cc03.jpg"><img src="http://s.cimg.163.com/stock/2015/8/31/201508311110060cc03.jpg.119x83.jpg" alt="中国手机的非洲历险记" /></a>                                <p>[摘要:中国手机全球化版图扩张中,已经完成了两个阶段,国内市场红海一片,几乎没有太多眷恋;欧美发达国家,市场如堡垒般稳固,而且面临专利、渠道等麻烦,败走麦城似乎是命中注定的事儿。]原标题:[亦观察] No.616&nbsp;中国手机的非洲历险记如今,中国手机正悄然转移重点,把  ...<br />
                <span class="time">2015-08-31 11:25:30</span>
            </p>
        </div>

展开
收起
杨冬芳 2016-06-17 13:06:09 2504 0
1 条回答
写回答
取消 提交回答
  • 码农|Coder| Pythonista

    建议使用beautifulsoup库解析,和前端操作dom类似解析html

    2019-07-17 19:42:32
    赞同 展开评论 打赏
问答排行榜
最热
最新

相关电子书

更多
Improving Python and Spark Per 立即下载
From Python Scikit-Learn to Sc 立即下载
Data Pre-Processing in Python: 立即下载