Can't find string after a tag with BeautifulSoup in Python?
<p>In this HTML I want to get the string of it but no matter what I try it doesn't work (string = none)</p>

<pre><code>      &lt;a href="/analyze/default/index/49398962/1/34925733" target="_blank"&gt;
       &lt;img alt="" class="ajax-tooltip shadow radius lazy" data-id="acctInfo:34925733_1" data-original="/upload/profileIconId/default.jpg" src="/images/common/transbg.png"/&gt;
       Jue VioIe Grace
      &lt;/a&gt;
</code></pre>

<p>There's a few of these on the page and I tried this:</p>

<pre><code>print([a.string for a in soup.findAll('td', class_='tou')])
</code></pre>

<p>The output is just none.</p>

<p>EDIT: here is the entire page HTML, hope this helps, just to clarify, I need to find all instances like the one above and extract their string</p>

<p><a href="http://pastebin.com/4mvcMsJu" rel="nofollow">http://pastebin.com/4mvcMsJu</a></p>

<p>Well, if your <code>soup</code> variable is made off that html piece of code then the output you get is <code>None</code> because there is no <code>td</code> element inside it, and of course there is not <code>td</code> element with <code>class=tou</code>.</p>

<p>Now, if you want to get that text maybe you could call <code>soup.findAll(text=True)</code> which outputs something like <code>['\n', '\n       Jue VioIe Grace\n      ']</code></p>

python beautifulsoup