Retrieving a specific line of text
<pre><code>&lt;li class="b-list__box-list-item b-list__box-list-item_type_block"&gt;
      &lt;i class="b-list__box-item-title b-list__box-item-title_type_width"&gt;
        Height:
      &lt;/i&gt;
      6' 2"
&lt;/li&gt;
</code></pre>

<p>For the above, I only want to retrieve 6'2" and ignore "height."  my code</p>

<pre><code>stat_one = stat_table_one.find_all("li", {"class": "b-list__box-list-item b-list__box-list-item_type_block"})

for li in stat_one:
    print li.get_text()
</code></pre>

<p>This code pulls "Height" and 6'2".  Is there a way to just get 6'2"?</p>

<pre><code>In [1]: from bs4 import BeautifulSoup

In [2]: h = """&lt;li class="b-list__box-list-item b-list__box-list-item_type_block"&gt;
   ...:       &lt;i class="b-list__box-item-title b-list__box-item-title_type_width"&gt;
   ...:         Height:
   ...:       &lt;/i&gt;
   ...:       6' 2"
   ...: &lt;/li&gt;
   ...: """    
In [3]: soup = BeautifulSoup(h,"html.parser")

In [4]: "".join(soup.find("li").find_all(text=True, recursive=False)).strip()

Out[4]: u'6\' 2"'
</code></pre>

<p>You dont want the child text so don't look recursively.</p>

python beautifulsoup