zoukankan      html  css  js  c++  java
  • python-爬虫(3)---lxml匹配css

    百度首页  部分代码

    <div class="s_tab_inner">
      <b>网页</b>
      <a href="//www.baidu.com/s?rtt=1&bsst=1&cl=2&tn=news&word=" wdfield="word" onmousedown="return c({'fm':'tab','tab':'news'})" sync="true">资讯</a>
      <a href="http://tieba.baidu.com/f?kw=&fr=wwwt" wdfield="kw" onmousedown="return c({'fm':'tab','tab':'tieba'})">贴吧</a>
      <a href="http://zhidao.baidu.com/q?ct=17&pn=0&tn=ikaslist&rn=10&word=&fr=wwwt" wdfield="word" onmousedown="return c({'fm':'tab','tab':'zhidao'})">知道</a>
      <a href="http://music.taihe.com/search?fr=ps&ie=utf-8&key=" wdfield="key" onmousedown="return c({'fm':'tab','tab':'music'})">音乐</a>
      <a href="http://image.baidu.com/search/index?tn=baiduimage&ps=1&ct=201326592&lm=-1&cl=2&nc=1&ie=utf-8&word=" wdfield="word" onmousedown="return c({'fm':'tab','tab':'pic'})">图片</a>
      <a href="http://v.baidu.com/v?ct=301989888&rn=20&pn=0&db=0&s=25&ie=utf-8&word=" wdfield="word" onmousedown="return c({'fm':'tab','tab':'video'})">视频</a>
      <a href="http://map.baidu.com/m?word=&fr=ps01000" wdfield="word" onmousedown="return c({'fm':'tab','tab':'map'})">地图</a>
      <a href="http://wenku.baidu.com/search?word=&lm=0&od=0&ie=utf-8" wdfield="word" onmousedown="return c({'fm':'tab','tab':'wenku'})">文库</a>
      <a href="//www.baidu.com/more/" onmousedown="return c({'fm':'tab','tab':'more'})">更多»</a>
    </div>

    根据css查找符合条件的内容

  • 相关阅读:
    day02_07 创建新目录
    day02_04 字典
    day02_02 列表切割
    day03_01 文件操作
    MS的TREE 控件使用
    使用自定义用户控件的一些经验
    Asp.net开发心得点滴[动态加载的用户控件使用事件委托,交给页面处理的事件无效问题]
    正则表达式基础学习[1]
    自定义控件无法在VS.net编辑中显示
    错误的递归
  • 原文地址:https://www.cnblogs.com/wozuilang-mdzz/p/9714050.html
Copyright © 2011-2022 走看看