#PyQuery: A python-like library of jquery

Source: Internet
Author: User

#出处: http://www.cnblogs.com/QLeelulu/archive/2010/03/05/pyQuery.html
#文档: The specific pyquery document is shown in: http://pyquery.org/
From pyquery import Pyquery as PQ
D=PQ (' D=PQ (url= ' http://www.qq.com ') #打开一个url
Print d (' title ') #获取title元素
Print d (' title '). Text () #获取title的标题
Print d (' #guess '). HTML () #获取id元素
Print D ('. S ') #根据类名获取元素
A=d (' #topNavIn li:eq (5) '). Find (' a ') #复杂的选择器也是可以的
A.attr (' href ') #获取属性
A.attr (' href ', ' http://qleelulu.cnblogs.com '). attr (' href ') #修改属性值
D (' #LoginFrom '). Hasclass (' Login_ajax ') #css类操作
D (' #LoginFrom '). addclass (' Lulu '). attr (' class ') #css类操作

#PyQuery: A python-like library of jquery

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.