V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
推荐学习书目
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
Waihinchan
V2EX  ›  Python

bs4 select 能用正则表达式吗?

  •  
  •   Waihinchan · 2019-09-25 04:20:46 +08:00 · 3164 次点击
    这是一个创建于 1646 天前的主题,其中的信息可能已经有所发展或是发生改变。

    如题。 我看到 find_all 是可以用正则表达式的。 如果我想用 soup.select 用正则表达式去匹配 id 的话,应该怎么操作呢?

    3 条回复    2019-09-25 08:45:24 +08:00
    AX5N
        1
    AX5N  
       2019-09-25 04:45:19 +08:00
    AX5N
        2
    AX5N  
       2019-09-25 04:46:23 +08:00
    一般来说这些库都会忠实还原原本应有的功能,原本能支持正则就能支持正则,原本不能支持就不能支持。
    lake325
        3
    lake325  
       2019-09-25 08:45:24 +08:00 via iPhone
    query 语句不就可以吗,为何非要用正则呢
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   3930 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 37ms · UTC 10:27 · PVG 18:27 · LAX 03:27 · JFK 06:27
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.