久久久久久久av_日韩在线中文_看一级毛片视频_日本精品二区_成人深夜福利视频_武道仙尊动漫在线观看

在 Python 中進行類似 jquery 的 HTML 解析?

jquery-like HTML parsing in Python?(在 Python 中進行類似 jquery 的 HTML 解析?)
本文介紹了在 Python 中進行類似 jquery 的 HTML 解析?的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

問題描述

是否有任何 Python 庫可以讓我解析類似于 jQuery 的 HTML 文檔?

Is there any Python library that allows me to parse an HTML document similar to what jQuery does?

即我希望能夠使用 CSS 選擇器語法 從文檔中抓取任意一組節點,讀取它們的內容/屬性等.

i.e. I'd like to be able to use CSS selectors syntax to grab an arbitrary set of nodes from the document, read their content/attributes, etc.

我以前使用過的唯一 Python HTML 解析庫是 BeautifulSoup,盡管它很好,但我一直認為如果我有可用的 jQuery 語法,我的解析會更快.:D

The only Python HTML parsing lib I've used before was BeautifulSoup, and even though it's fine I keep thinking it would be faster to do my parsing if I had jQuery syntax available. :D

推薦答案

如果你精通BeautifulSoup,您只需將 soupselect 添加到您的庫中.
Soupselect 是 BeautifulSoup 的 CSS 選擇器擴展.

If you are fluent with BeautifulSoup, you could just add soupselect to your libs.
Soupselect is a CSS selector extension for BeautifulSoup.

用法:

from bs4 import BeautifulSoup as Soup
from soupselect import select
import urllib
soup = Soup(urllib.urlopen('http://slashdot.org/'))
select(soup, 'div.title h3')

    [<h3><span><a href='//science.slashdot.org/'>Science</a>:</span></h3>,
     <h3><a href='//slashdot.org/articles/07/02/28/0120220.shtml'>Star Trek</h3>,
    ..]

這篇關于在 Python 中進行類似 jquery 的 HTML 解析?的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!

【網站聲明】本站部分內容來源于互聯網,旨在幫助大家更快的解決問題,如果有圖片或者內容侵犯了您的權益,請聯系我們刪除處理,感謝您的支持!

相關文檔推薦

How to draw a rectangle around a region of interest in python(如何在python中的感興趣區域周圍繪制一個矩形)
How can I detect and track people using OpenCV?(如何使用 OpenCV 檢測和跟蹤人員?)
How to apply threshold within multiple rectangular bounding boxes in an image?(如何在圖像的多個矩形邊界框中應用閾值?)
How can I download a specific part of Coco Dataset?(如何下載 Coco Dataset 的特定部分?)
Detect image orientation angle based on text direction(根據文本方向檢測圖像方向角度)
Detect centre and angle of rectangles in an image using Opencv(使用 Opencv 檢測圖像中矩形的中心和角度)
主站蜘蛛池模板: 国产精品一区一区三区 | 亚洲天堂一区二区三区 | 中文字幕在线日韩 | 久久精品99久久久久久 | 青草视频在线播放 | 国产精品手机在线观看 | 伊人9999| 国产精品入口66mio男同 | 精品国产99久久久久久宅男i | 色婷婷av一区二区三区之e本道 | 免费黄色一级视频 | www.男人的天堂 | 日日骚av| 成年人免费看视频 | 亚洲国产成人精品女人久久久 | 成人影片在线 | 成人日韩在线 | 久久精品国产一区 | 国产黄色免费 | 久草福利在线观看 | 丰满少妇高潮无套内谢 | 天堂网久久 | 中文字幕在线免费看线人 | 成人免费高清视频 | 国产网友自拍 | 五月激情综合 | 国产精品亚洲精品 | 日本国产欧美 | 精品一区二区三区四区五区 | 免费的黄色小视频 | 国产777| 一区二区免费在线观看 | 国产成人99久久亚洲综合精品 | 国产h在线| 日本特黄特色aaa大片免费 | 99精品久久久久久中文字幕 | 在线看片你懂的 | av狠狠干| 国产精品国产三级国产aⅴ浪潮 | 日韩在线视频一区二区三区 | 一区二区高清视频 |