推荐学习书目
› Learn Python the Hard Way
Python Sites
› PyPI - Python Package Index
› http://diveintopython.org/toc/index.html
› Pocoo
值得关注的项目
› PyPy
› Celery
› Jinja2
› Read the Docs
› gevent
› pyenv
› virtualenv
› Stackless Python
› Beautiful Soup
› 结巴中文分词
› Green Unicorn
› Sentry
› Shovel
› Pyflakes
› pytest
Python 编程
› pep8 Checker
Styles
› PEP 8
› Google Python Style Guide
› Code Style from The Hitchhiker's Guide
sparkssssssss
V2EX  ›  Python

请教个 html 解析的问题

  •  
  •   sparkssssssss · Mar 27, 2021 · 1650 views
    This topic created in 2010 days ago, the information mentioned may be changed or developed.
    最近写了个脚本抓电视节目自用,遇到了个小问题,请教下,对于一个标签内,我怎么判断 a 标签的内容是在前还是后啊?
    如下情况,第一种 a 标签在后面呢,第二种情况,a 标签的内容就在前面,我目前是获取./span/text() + ./span/a/@href ,有些就是反的....
    <span class="p_show">海豚万家剧场:<a title="康熙王朝剧情介绍 " href="/drama/MnJXVQ==">康熙王朝</a></span>
    <span class="p_show"><a title="宇宙护卫队剧情介绍 " href="/drama/JFxhX2Nv">宇宙护卫队</a>2:爱探险的小梅花鹿</span>
    tia
        1
    tia  
       Mar 27, 2021
    试试 beautifulsoup
    sparkssssssss
        2
    sparkssssssss  
    OP
       Mar 27, 2021 via Android
    和 lxml 原理不一样吗?
    bs 怎么判断前后呢?请教
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Privacy   ·   Solana   ·   5159 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 35ms · UTC 06:10 · PVG 14:10 · LAX 23:10 · JFK 02:10
    ♥ Do have faith in what you're doing.