Python's Pyquery Usage summary

Source: Internet
Author: User

What is Pyquerywhen we use crawlers to crawl Web pages, we also need to process the crawled HTML content to get the information we need. Pyquery is a python implementation of jquery that can be used to parse HTML content. installationmy environment: Ubuntu 14.04+python2.7command: Pip install pyqueryUseLoading HTML contentFrom pyquery import pyquery as PQHTML content can be loaded from a string, file, or URL
From pyquery import pyquery as Pqdoc_1 = PQ ("
get elements based on HTML tags 
From pyquery import pyquery as Pqdoc_1 = PQ ("
get HTML blocks or blocks of textuse HTML () and text ()
From pyquery import pyquery as Pqdoc_1 = PQ ("
getting elements from an indexEQ (index)  
From pyquery import pyquery as Pqdoc_1 = PQ ("
    get elements based on class name and ID
From pyquery import pyquery as Pqdoc_1 = PQ ("
Get property value
From pyquery import pyquery as Pqdoc_1 = PQ ("
modifying property values
From pyquery import pyquery as Pqdoc_1 = PQ ("
Find nested elements find ()
From pyquery import pyquery as Pqdoc_1 = PQ ("
Get child elements
From pyquery import pyquery as Pqdoc_1 = PQ ("
Get parent Element
From pyquery import pyquery as Pqdoc_1 = PQ ("
To add a class to an element
From pyquery import pyquery as Pqdoc_1 = PQ ("
Determines whether the element has a given class
From pyquery import pyquery as Pqdoc_1 = PQ ("

Python's Pyquery Usage summary

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.