bs4.Declaration

class bs4.Declaration[source]
__init__

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

Methods

append(tag) Appends the given tag to the contents of this tag.
capitalize(() -> unicode) Return a capitalized version of S, i.e.
center((width[, fillchar]) -> unicode) Return S centered in a Unicode string of length width.
count((sub[, start[, end]]) -> int) Return the number of non-overlapping occurrences of substring sub in Unicode string S[start:end].
decode(...) Decodes S using the codec registered for encoding.
encode(...) Encodes S using the codec registered for encoding.
endswith((suffix[, start[, end]]) -> bool) Return True if S ends with the specified suffix, False otherwise.
expandtabs(([tabsize]) -> unicode) Return a copy of S where all tab characters are expanded using spaces.
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.
find((sub [,start [,end]]) -> int) Return the lowest index in S where substring sub is found, such that sub is contained within S[start:end].
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((*args, **kwargs) -> unicode) Return a formatted version of S, using substitutions from args and kwargs.
format_string(s[, formatter]) Format the given string using the given formatter.
index((sub [,start [,end]]) -> int) Like S.find() but raise ValueError when the substring is not found.
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.
isalnum(() -> bool) Return True if all characters in S are alphanumeric and there is at least one character in S, False otherwise.
isalpha(() -> bool) Return True if all characters in S are alphabetic and there is at least one character in S, False otherwise.
isdecimal(() -> bool) Return True if there are only decimal characters in S, False otherwise.
isdigit(() -> bool) Return True if all characters in S are digits and there is at least one character in S, False otherwise.
islower(() -> bool) Return True if all cased characters in S are lowercase and there is at least one cased character in S, False otherwise.
isnumeric(() -> bool) Return True if there are only numeric characters in S, False otherwise.
isspace(() -> bool) Return True if all characters in S are whitespace and there is at least one character in S, False otherwise.
istitle(() -> bool) Return True if S is a titlecased string and there is at least one character in S, i.e.
isupper(() -> bool) Return True if all cased characters in S are uppercase and there is at least one cased character in S, False otherwise.
join((iterable) -> unicode) Return a string which is the concatenation of the strings in the iterable.
ljust((width[, fillchar]) -> int) Return S left-justified in a Unicode string of length width.
lower(() -> unicode) Return a copy of the string S converted to lowercase.
lstrip(([chars]) -> unicode) Return a copy of the string S with leading whitespace removed.
nextGenerator()
nextSiblingGenerator()
output_ready([formatter]) CData strings are passed into the formatter.
parentGenerator()
partition(sep) -> (head, sep, tail) Search for the separator sep in S, and return the part before it, the separator itself, and the part after it.
previousGenerator()
previousSiblingGenerator()
replace((old, new[, count]) -> unicode) Return a copy of S with all occurrences of substring old replaced by new.
replaceWith(replace_with)
replaceWithChildren()
replace_with(replace_with)
replace_with_children()
rfind((sub [,start [,end]]) -> int) Return the highest index in S where substring sub is found, such that sub is contained within S[start:end].
rindex((sub [,start [,end]]) -> int) Like S.rfind() but raise ValueError when the substring is not found.
rjust((width[, fillchar]) -> unicode) Return S right-justified in a Unicode string of length width.
rpartition(sep) -> (head, sep, tail) Search for the separator sep in S, starting at the end of S, and return the part before it, the separator itself, and the part after it.
rsplit(([sep [,maxsplit]]) -> list of strings) Return a list of the words in S, using sep as the delimiter string, starting at the end of the string and working to the front.
rstrip(([chars]) -> unicode) Return a copy of the string S with trailing whitespace removed.
setup([parent, previous_element, ...]) Sets up the initial relations between this element and other elements.
split(([sep [,maxsplit]]) -> list of strings) Return a list of the words in S, using sep as the delimiter string.
splitlines((keepends=False) -> list of strings) Return a list of the lines in S, breaking at line boundaries.
startswith((prefix[, start[, end]]) -> bool) Return True if S starts with the specified prefix, False otherwise.
strip(([chars]) -> unicode) Return a copy of the string S with leading and trailing whitespace removed.
swapcase(() -> unicode) Return a copy of S with uppercase characters converted to lowercase and vice versa.
title(() -> unicode) Return a titlecased version of S, i.e.
translate((table) -> unicode) Return a copy of the string S, where all characters have been mapped through the given translation table, which must be a mapping of Unicode ordinals to Unicode ordinals, Unicode strings or None.
unwrap()
upper(() -> unicode) Return a copy of S converted to uppercase.
wrap(wrap_inside)
zfill((width) -> unicode) Pad a numeric string S with zeros on the left, to fill a field of the specified width.