Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>In this case, <code>A</code> is a single result of a given type.</p> <pre><code>&gt;&gt;&gt; type(A) &lt;class 'bs4.element.Tag'&gt; </code></pre> <p>When you traverse this object <code>A</code>, you are yielding an object B:</p> <pre><code>&gt;&gt;&gt; type(B) &lt;class 'bs4.element.NavigableString'&gt; </code></pre> <p>In this case, <code>bs4.element.NavigableString</code> does not actually contain the method <code>renderContents</code>. This can be verified as such:</p> <pre><code>&gt;&gt;&gt; dir(B) ['HTML_FORMATTERS', 'PREFIX', 'SUFFIX', 'XML_FORMATTERS', '__add__', '__class__', '__contains__', '__copy__', '__delattr__', '__dict__', '__doc__', '__eq__', '__format__', '__ge__', '__getattr__', '__getattribute__', '__getitem__', '__getnewargs__', '__getslice__', '__gt__', '__hash__', '__init__', '__le__', '__len__', '__lt__', '__mod__', '__module__', '__mul__', '__ne__', '__new__', '__reduce__', '__reduce_ex__', '__repr__', '__rmod__', '__rmul__', '__setattr__', '__sizeof__', '__str__', '__subclasshook__', '__weakref__', '_attr_value_as_string', '_attribute_checker', '_find_all', '_find_one', '_formatter_field_name_split', '_formatter_for_name', '_formatter_parser', '_is_xml', '_lastRecursiveChild', '_last_descendant', '_tag_name_matches_and', 'append', 'attribselect_re', 'capitalize', 'center', 'count', 'decode', 'encode', 'endswith', 'expandtabs', 'extract', 'fetchNextSiblings', 'fetchParents', 'fetchPrevious', 'fetchPreviousSiblings', 'find', 'findAllNext', 'findAllPrevious', 'findNext', 'findNextSibling', 'findNextSiblings', 'findParent', 'findParents', 'findPrevious', 'findPreviousSibling', 'findPreviousSiblings', 'find_all_next', 'find_all_previous', 'find_next', 'find_next_sibling', 'find_next_siblings', 'find_parent', 'find_parents', 'find_previous', 'find_previous_sibling', 'find_previous_siblings', 'format', 'format_string', 'index', 'insert', 'insert_after', 'insert_before', 'isalnum', 'isalpha', 'isdecimal', 'isdigit', 'islower', 'isnumeric', 'isspace', 'istitle', 'isupper', 'join', 'ljust', 'lower', 'lstrip', 'name', 'next', 'nextGenerator', 'nextSibling', 'nextSiblingGenerator', 'next_element', 'next_elements', 'next_sibling', 'next_siblings', 'output_ready', 'parent', 'parentGenerator', 'parents', 'partition', 'previous', 'previousGenerator', 'previousSibling', 'previousSiblingGenerator', 'previous_element', 'previous_elements', 'previous_sibling', 'previous_siblings', 'replace', 'replaceWith', 'replaceWithChildren', 'replace_with', 'replace_with_children', 'rfind', 'rindex', 'rjust', 'rpartition', 'rsplit', 'rstrip', 'setup', 'split', 'splitlines', 'startswith', 'strip', 'swapcase', 'tag_name_re', 'title', 'translate', 'unwrap', 'upper', 'wrap', 'zfill'] </code></pre> <p>Here's what you probably actually wanted (without the slice notation on findAll):</p> <pre><code>A = soup.findAll('strong',{'class':'name fn'}) # Notice there is no [0] slice notation here. for B in A: print B.renderContents() </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload