near_me
Linear Algebra
keyboard_arrow_down 54 guides
chevron_leftBeautiful Soup
check_circle
Mark as learned thumb_up
1
thumb_down
0
chat_bubble_outline
0
Comment auto_stories Bi-column layout
settings
Beautiful Soup | API reference
schedule Aug 12, 2023
Last updated local_offer
Tags Python●Beautiful Soup
tocTable of Contents
expand_more Master the mathematics behind data science with 100+ top-tier guides
Start your free 7-days trial now!
Start your free 7-days trial now!
- Beautiful Soup | append methodBeautiful Soup's Tag.append(~) method adds the provided input to the tag's content.
- Beautiful Soup Tag | clear methodIn Beautiful Soup, the clear method removes the inner content of a tag, while keeping the tag itself.
- Beautiful Soup Tag | decompose methodBeautiful Soup's decompose() method removes a tag as well as its inner content.
- Beautiful Soup | extend methodBeautiful Soup's Tag.extend(~) adds all elements of a list to a Tag in order.
- Beautiful Soup | extract methodIn Beautiful Soup, the extract method removes either: an element and its string, or a string.
- Beautiful Soup | find methodBeautiful Soup's find(~) method returns the first tag that matches the search criteria. If you would like to return all tags that match a particular criteria, refer to the find_all(~) method.
- Beautiful Soup | find_all methodBeautiful Soup's find_all(~) method returns a list of all the tags that match a particular criteria.
- Beautiful Soup | find_all_next methodBeautiful Soup's find_all_next(~) method returns tags that come after the current tag. This method takes in the exact same parameters as find_all(~). If no parameter is specified, then all tags will be returned.
- Beautiful Soup | find_next methodBeautiful Soup's find_next(~) method returns the first tag that comes after the current tag in the document. This method takes in the exact same parameters as find(~).
- Beautiful Soup | find_next_sibling methodIn Beautiful Soup, the find_next_sibling() method of a tag returns the next element under the same parent.
- Beautiful Soup | find_parent methodBeautiful Soup's find_parent(~) method returns the parent of a particular tag (or string).
- Beautiful Soup | find_parents methodBeautiful Soup's find_parents(~) method works its way up the parse tree and finds the parents of a particular tag or string.
- Beautiful Soup | find_previous_sibling methodIn Beautiful Soup, the find_previous_sibling() method of a tag returns the next element under the same parent.
- Beautiful Soup Tag | get_text methodBeautiful Soup's Tag.get_text() method returns the text within the tag.
- Beautiful Soup | has_attr methodBeautiful Soup's has_attr(~) method returns a Boolean indicating whether an element contains a specific attribute.
- Beautiful Soup | insert methodBeautiful Soup's Tag.insert(~) method adds the provided input to a tag's content at the provided numeric position.
- Beautiful Soup | insert_after methodBeautiful Soup's insert_after(~) method inserts the specified tag or string directly after a particular element in the parse tree.
- Beautiful Soup | insert_before methodBeautiful Soup's insert_before(~) method inserts the specified tag or string directly before a particular element in the parse tree.
- Beautiful Soup | new_tag methodBeautiful Soup's new_tag(~) method creates a new tag that we can then insert into the parse tree.
- Beautiful Soup | prettify methodBeautiful Soup's prettify() method formats the Beautiful Soup parse tree so that there each tag is on its own separate line with indentation. It is used to easily visualize the structure of the Beautiful Soup parse tree.
- Beautiful Soup | replace_with methodBeautiful Soup's replace_with(~) method replaces a tag or string in an element with the provided tag or string.
- Beautiful Soup | select methodBeautiful Soup's select(~) method returns a list of all the tags that match a particular criteria.
- Beautiful Soup | select_one methodBeautiful Soup's select_one(~) method returns the first tag that match a particular criteria.
- Beautiful Soup | unwrap methodBeautiful Soup's unwrap() method removes the tag from an element and returns it.
- Beautiful Soup | wrap methodBeautiful Soup's wrap(~) method wraps an element with the specified tag and returns the new wrapper.
- Beautiful Soup Tag | children propertyThe Tag.children property in Beautiful Soup returns a generator used to iterate over the immediate child elements and text nodes (i.e. Navigable String).
- Beautiful Soup Tag | contents propertyThe Tag.contents property in Beautiful Soup returns a list that contains all the immediate child elements and text nodes (i.e. Navigable String).
- Beautiful Soup Tag | descendants propertyThe Tag.descendants property in Beautiful Soup returns a generator used to iterate over the all child elements and text nodes (i.e. Navigable String).
- Beautiful Soup | next_element propertyIn Beautiful Soup, the next_element property returns the next string or tag in the parse tree. We will go through the subtleties of this property using examples.
- Beautiful Soup | next_elements propertyIn Beautiful Soup, the next_elements property of a tag or a string returns a generator used to iterate over all the next strings or tags in the parse tree.
- Beautiful Soup | next_sibling propertyIn Beautiful Soup, the next_sibling property of a tag or a string returns the next tag or string under the same parent.
- Beautiful Soup | next_siblings propertyIn Beautiful Soup, the next_siblings property of a tag or a string returns a generator used to iterate over all the subsequent tags and strings under the same parent.
- Beautiful Soup | parent propertyThe Tag.parent property returns the parent for the particular tag.
- Beautiful Soup | parents propertyThe Tag.parents property returns a generator used to iterate over the parent tags.
- Beautiful Soup | previous_element propertyIn Beautiful Soup, the previous_element property returns the previous string or tag in the parse tree. We will go through the subtleties of this property using examples.
- Beautiful Soup | previous_elements propertyIn Beautiful Soup, the previous_elements property returns a generator object containing the previous strings or tags in the parse tree.
- Beautiful Soup | previous_sibling propertyIn Beautiful Soup, the previous_sibling property of a tag or a string returns the previous tag or string under the same parent.
- Beautiful Soup | previous_siblings propertyIn Beautiful Soup, the previous_siblings property of a tag or a string returns a generator used to iterate over all the previous tags and strings under the same parent.
- Beautiful Soup Tag | string propertyIn Beautiful Soup, the string property returns a NavigableString object, which is similar to a typical Python string with additional helper methods and properties to navigate around the HTML document.
- Beautiful Soup Tag | strings propertyThe strings property returns the inner text of an element. Unlike the string property, strings handles the case when the element contains multiple children.
- Beautiful Soup Tag | stripped_strings propertyJust like the strings property, the stripped_strings returns the inner text of an element. The difference is that stripped_strings omits lines that consist of just empty spaces, and also removes leading and trailing spaces.
Published by Isshin Inada
Edited by 0 others
Did you find this page useful?
thumb_up
thumb_down
Comment
Citation
Ask a question or leave a feedback...
thumb_up
1
thumb_down
0
chat_bubble_outline
0
settings
Enjoy our search
Hit / to insta-search docs and recipes!