国产成人精品亚洲777人妖,欧美日韩精品一区视频,最新亚洲国产,国产乱码精品一区二区亚洲

您的位置:首頁(yè)技術(shù)文章
文章詳情頁(yè)

python中PyQuery庫(kù)用法分享

瀏覽:6日期:2022-06-29 17:09:59

PyQuery庫(kù)就是python中的一個(gè)解析庫(kù)。作用十分強(qiáng)大,使用上也是相當(dāng)?shù)撵`活,能夠?qū)崿F(xiàn)初始化字符串、初始化 HTML 文件、初始化請(qǐng)求響應(yīng)等多種場(chǎng)景,另外,本身中的CSS選擇器,也是經(jīng)常被大家使用的對(duì)象,結(jié)合以上的大致內(nèi)容總結(jié),接下來(lái),我們一起詳細(xì)的了解使用內(nèi)容。

安裝:

>>> pip3 install pyquery

引用方法:

from pyquery import PyQuery as pq

CSS選擇器:

from pyquery import PyQuery as pqhtml = ’’’<div id='container'><ul class='list'><li class='item-0'>first item</li><li class='item-1'><a href='http://www.intensediesel.com/bcjs/link2.html' rel='external nofollow' >second item</a></li><li class='item-0 active'><a href='http://www.intensediesel.com/bcjs/link3.html' rel='external nofollow' ><span class='bold'>third item</span></a></li><li class='item-1 active'><a href='http://www.intensediesel.com/bcjs/link4.html' rel='external nofollow' >fourth item</a></li><li class='item-0'><a href='http://www.intensediesel.com/bcjs/link5.html' rel='external nofollow' >fifth item</a></li></ul></div>’’’doc=pq(html)print(doc('#container .list li'))

輸出結(jié)果:

python中PyQuery庫(kù)用法分享

到此這篇關(guān)于python中PyQuery庫(kù)用法分享的文章就介紹到這了,更多相關(guān)python中PyQuery庫(kù)是什么內(nèi)容請(qǐng)搜索好吧啦網(wǎng)以前的文章或繼續(xù)瀏覽下面的相關(guān)文章希望大家以后多多支持好吧啦網(wǎng)!

標(biāo)簽: Python 編程
相關(guān)文章:
主站蜘蛛池模板: 锦州市| 任丘市| 呼伦贝尔市| 张家港市| 子长县| 无为县| 浮梁县| 吉水县| 浏阳市| 五峰| 红桥区| 永平县| 镇康县| 武汉市| 马山县| 肇东市| 桦甸市| 惠东县| 黄石市| 大渡口区| 东乡县| 邢台市| 太保市| 星子县| 海口市| 汾西县| 仁怀市| 临猗县| 平陆县| 鱼台县| 柯坪县| 冀州市| 哈巴河县| 磴口县| 乐亭县| 华坪县| 镇赉县| 湛江市| 邢台市| 丰县| 乳山市|