运行结不雅
- hello
- <p id="plop" class="hello"/>
- <p id="hello" class="hello"/>
再来一发
- from pyquery import PyQuery as pq
- p = pq('<p id="hello" class="hello"></p>')('p')
- print p.addClass('beauty')
- print p.removeClass('hello')
- print p.css('font-size', '16px')
- print p.css({'background-color': 'yellow'})
运行结不雅
- <p id="hello" class="hello beauty"/>
- <p id="hello" class="beauty"/>
- <p id="hello" class="beauty" style="font-size: 16px"/>
- <p id="hello" class="beauty" style="font-size: 16px; background-color: yellow"/>
依旧是那媚暌高古与自负!
在这里我们发清楚明了,这是连续串的操作,而 p 是一向在本来的结不雅上变更的。
是以履行上述操作之后,p 本身也产生了变更。
DOM操作
遍历
同样的原汁原味的 jQuery 语法
- from pyquery import PyQuery as pq
- p = pq('<p id="hello" class="hello"></p>')('p')
- print p.append(' check out <a href=http://developer.51cto.com/art/201705/"http://reddit.com/r/python">
推荐阅读
OTT IPTV商机广阔 运营商如何进一步发掘CDN机会窗口
在此前4月份的亚太CDN峰会上,中国联通收集技巧研究院、高等工程师乔治曾做过一个猜测:全球流量复合增长率占>>>详细阅读
地址:http://www.17bianji.com/lsqh/35490.html
1/2 1