MCPcopy Create free account
hub / github.com/gawel/pyquery / remove_attr

Method remove_attr

pyquery/pyquery.py:798–814  ·  view source on GitHub ↗

Remove an attribute:: >>> d = PyQuery(' ') >>> d.remove_attr('id') [ ] >>> d.removeAttr('id') [ ] ..

(self, name)

Source from the content-addressed store, hash-verified

796
797 @with_camel_case_alias
798 def remove_attr(self, name):
799 """Remove an attribute::
800
801 >>> d = PyQuery('<div id="myid"></div>')
802 >>> d.remove_attr('id')
803 [<div>]
804 >>> d.removeAttr('id')
805 [<div>]
806
807 ..
808 """
809 for tag in self:
810 try:
811 del tag.attrib[name]
812 except KeyError:
813 pass
814 return self
815
816 attr = FlexibleElement(pget=attr, pdel=remove_attr)
817

Callers 1

attrMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected