bs4.PageElement

class bs4.PageElement[source]

Contains the navigational information for some part of the page (either a tag or a piece of text)

__init__

x.__init__(...) initializes x; see help(type(x)) for signature

Methods

append(tag) Appends the given tag to the contents of this tag.
extract() Destructively rips this element out of the tree.
fetchNextSiblings([name, attrs, text, limit]) Returns the siblings of this Tag that match the given criteria and appear after this Tag in the document.
fetchParents([name, attrs, limit]) Returns the parents of this Tag that match the given criteria.
fetchPrevious([name, attrs, text, limit]) Returns all items that match the given criteria and appear before this Tag in the document.
fetchPreviousSiblings([name, attrs, text, limit]) Returns the siblings of this Tag that match the given criteria and appear before this Tag in the document.
findAllNext([name, attrs, text, limit]) Returns all items that match the given criteria and appear after this Tag in the document.
findAllPrevious([name, attrs, text, limit]) Returns all items that match the given criteria and appear before this Tag in the document.
findNext([name, attrs, text]) Returns the first item that matches the given criteria and appears after this Tag in the document.
findNextSibling([name, attrs, text]) Returns the closest sibling to this Tag that matches the given criteria and appears after this Tag in the document.
findNextSiblings([name, attrs, text, limit]) Returns the siblings of this Tag that match the given criteria and appear after this Tag in the document.
findParent([name, attrs]) Returns the closest parent of this Tag that matches the given criteria.
findParents([name, attrs, limit]) Returns the parents of this Tag that match the given criteria.
findPrevious([name, attrs, text]) Returns the first item that matches the given criteria and appears before this Tag in the document.
findPreviousSibling([name, attrs, text]) Returns the closest sibling to this Tag that matches the given criteria and appears before this Tag in the document.
findPreviousSiblings([name, attrs, text, limit]) Returns the siblings of this Tag that match the given criteria and appear before this Tag in the document.
find_all_next([name, attrs, text, limit]) Returns all items that match the given criteria and appear after this Tag in the document.
find_all_previous([name, attrs, text, limit]) Returns all items that match the given criteria and appear before this Tag in the document.
find_next([name, attrs, text]) Returns the first item that matches the given criteria and appears after this Tag in the document.
find_next_sibling([name, attrs, text]) Returns the closest sibling to this Tag that matches the given criteria and appears after this Tag in the document.
find_next_siblings([name, attrs, text, limit]) Returns the siblings of this Tag that match the given criteria and appear after this Tag in the document.
find_parent([name, attrs]) Returns the closest parent of this Tag that matches the given criteria.
find_parents([name, attrs, limit]) Returns the parents of this Tag that match the given criteria.
find_previous([name, attrs, text]) Returns the first item that matches the given criteria and appears before this Tag in the document.
find_previous_sibling([name, attrs, text]) Returns the closest sibling to this Tag that matches the given criteria and appears before this Tag in the document.
find_previous_siblings([name, attrs, text, ...]) Returns the siblings of this Tag that match the given criteria and appear before this Tag in the document.
format_string(s[, formatter]) Format the given string using the given formatter.
insert(position, new_child)
insert_after(successor) Makes the given element the immediate successor of this one.
insert_before(predecessor) Makes the given element the immediate predecessor of this one.
nextGenerator()
nextSiblingGenerator()
parentGenerator()
previousGenerator()
previousSiblingGenerator()
replaceWith(replace_with)
replaceWithChildren()
replace_with(replace_with)
replace_with_children()
setup([parent, previous_element, ...]) Sets up the initial relations between this element and other elements.
unwrap()
wrap(wrap_inside)