发布于 2016-10-31 15:39:14 | 315 次阅读 | 评论: 0 | 来源: PHPERZ
You can play with the attributes with the jquery API:
>>> p.attr("id") 'hello' >>> p.attr("id", "plop") [<p#plop.hello>] >>> p.attr("id", "hello") [<p#hello.hello>]
或者使用更加符合python模式的方法:
>>> p.attr.id = "plop" >>> p.attr.id 'plop' >>> p.attr["id"] = "ola" >>> p.attr["id"] 'ola' >>> p.attr(id='hello', class_='hello2') [<p#hello.hello2>] >>> p.attr.class_ 'hello2' >>> p.attr.class_ = 'hello