Represents a found HTML tag with its attributes and contents.
|
__init__(self,
parser,
name,
attrs=None,
parent=None,
previous=None)
Basic constructor. |
source code
|
|
|
get(self,
key,
default=None)
Returns the value of the 'key' attribute for the tag, or the value
given for 'default' if it doesn't have that attribute. |
source code
|
|
|
|
|
__getitem__(self,
key)
tag[key] returns the value of the 'key' attribute for the tag, and
throws an exception if it's not there. |
source code
|
|
|
__iter__(self)
Iterating over a tag iterates over its contents. |
source code
|
|
|
__len__(self)
The length of a tag is the length of its list of contents. |
source code
|
|
|
|
|
__nonzero__(self)
A tag is non-None even if it has no contents. |
source code
|
|
|
__setitem__(self,
key,
value)
Setting tag[key] sets the value of the 'key' attribute for the tag. |
source code
|
|
|
__delitem__(self,
key)
Deleting tag[key] deletes all 'key' attributes for the tag. |
source code
|
|
|
__call__(self,
*args,
**kwargs)
Calling a tag like a function is the same as calling its findAll()
method. |
source code
|
|
|
|
|
__eq__(self,
other)
Returns true iff this tag has the same name, the same attributes, and
the same contents (recursively) as the given tag. |
source code
|
|
|
__ne__(self,
other)
Returns true iff this tag is not identical to the other tag, as
defined in __eq__. |
source code
|
|
|
__repr__(self,
encoding=' utf-8 ' )
Renders this tag as a string. |
source code
|
|
|
|
|
|
|
encode(self,
encoding=' utf-8 ' ,
prettyPrint=False,
indentLevel=0) |
source code
|
|
|
decode(self,
prettyPrint=False,
indentLevel=0,
eventualEncoding=' utf-8 ' )
Returns a string or Unicode representation of this tag and its
contents. |
source code
|
|
|
decompose(self)
Recursively destroys the contents of this tree. |
source code
|
|
|
|
|
encodeContents(self,
encoding=' utf-8 ' ,
prettyPrint=False,
indentLevel=0) |
source code
|
|
|
decodeContents(self,
prettyPrint=False,
indentLevel=0,
eventualEncoding=' utf-8 ' )
Renders the contents of this tag as a string in the given encoding. |
source code
|
|
|
find(self,
name=None,
attrs={ } ,
recursive=True,
text=None,
**kwargs)
Return only the first child of this Tag matching the given criteria. |
source code
|
|
|
findChild(self,
name=None,
attrs={ } ,
recursive=True,
text=None,
**kwargs)
Return only the first child of this Tag matching the given criteria. |
source code
|
|
|
findAll(self,
name=None,
attrs={ } ,
recursive=True,
text=None,
limit=None,
**kwargs)
Extracts a list of Tag objects that match the given criteria. |
source code
|
|
|
findChildren(self,
name=None,
attrs={ } ,
recursive=True,
text=None,
limit=None,
**kwargs)
Extracts a list of Tag objects that match the given criteria. |
source code
|
|
|
first(self,
name=None,
attrs={ } ,
recursive=True,
text=None,
**kwargs)
Return only the first child of this Tag matching the given criteria. |
source code
|
|
|
fetch(self,
name=None,
attrs={ } ,
recursive=True,
text=None,
limit=None,
**kwargs)
Extracts a list of Tag objects that match the given criteria. |
source code
|
|
|
fetchText(self,
text=None,
recursive=True,
limit=None) |
source code
|
|
|
|
|
renderContents(self,
encoding=' utf-8 ' ,
prettyPrint=False,
indentLevel=0) |
source code
|
|
|
|
|
|
|
|
|
|
|
fetchNextSiblings(self,
name=None,
attrs={ } ,
text=None,
limit=None,
**kwargs)
Returns the siblings of this Tag that match the given criteria and
appear after this Tag in the document.
(Inherited from rosdeb.BeautifulSoup.PageElement) |
source code
|
|
|
|
|
fetchPrevious(self,
name=None,
attrs={ } ,
text=None,
limit=None,
**kwargs)
Returns all items that match the given criteria and appear before
this Tag in the document.
(Inherited from rosdeb.BeautifulSoup.PageElement) |
source code
|
|
|
fetchPreviousSiblings(self,
name=None,
attrs={ } ,
text=None,
limit=None,
**kwargs)
Returns the siblings of this Tag that match the given criteria and
appear before this Tag in the document.
(Inherited from rosdeb.BeautifulSoup.PageElement) |
source code
|
|
|
findAllNext(self,
name=None,
attrs={ } ,
text=None,
limit=None,
**kwargs)
Returns all items that match the given criteria and appear after this
Tag in the document.
(Inherited from rosdeb.BeautifulSoup.PageElement) |
source code
|
|
|
findAllPrevious(self,
name=None,
attrs={ } ,
text=None,
limit=None,
**kwargs)
Returns all items that match the given criteria and appear before
this Tag in the document.
(Inherited from rosdeb.BeautifulSoup.PageElement) |
source code
|
|
|
findNext(self,
name=None,
attrs={ } ,
text=None,
**kwargs)
Returns the first item that matches the given criteria and appears
after this Tag in the document.
(Inherited from rosdeb.BeautifulSoup.PageElement) |
source code
|
|
|
findNextSibling(self,
name=None,
attrs={ } ,
text=None,
**kwargs)
Returns the closest sibling to this Tag that matches the given
criteria and appears after this Tag in the document.
(Inherited from rosdeb.BeautifulSoup.PageElement) |
source code
|
|
|
findNextSiblings(self,
name=None,
attrs={ } ,
text=None,
limit=None,
**kwargs)
Returns the siblings of this Tag that match the given criteria and
appear after this Tag in the document.
(Inherited from rosdeb.BeautifulSoup.PageElement) |
source code
|
|
|
|
|
|
|
findPrevious(self,
name=None,
attrs={ } ,
text=None,
**kwargs)
Returns the first item that matches the given criteria and appears
before this Tag in the document.
(Inherited from rosdeb.BeautifulSoup.PageElement) |
source code
|
|
|
findPreviousSibling(self,
name=None,
attrs={ } ,
text=None,
**kwargs)
Returns the closest sibling to this Tag that matches the given
criteria and appears before this Tag in the document.
(Inherited from rosdeb.BeautifulSoup.PageElement) |
source code
|
|
|
findPreviousSiblings(self,
name=None,
attrs={ } ,
text=None,
limit=None,
**kwargs)
Returns the siblings of this Tag that match the given criteria and
appear before this Tag in the document.
(Inherited from rosdeb.BeautifulSoup.PageElement) |
source code
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|