Regular expression to extract data from news page
<p>Hi I'm running python regular expression to extract some data from news pages, however when it is displayed the code produces brackets and apostrophes in the output. For example this is my code:</p>

<pre><code>description_title = findall('&lt;item&gt;[\s]*&lt;title[^&gt;]*&gt;(.*?)&lt;\/title&gt;[\s]*&lt;description&gt;', html_source)[:1]
        news_file.write('&lt;h3 align="Center"&gt;' + str(description_title) + ": " + '&lt;/h3\n&gt;')
</code></pre>

<p>but this code creates the output of ['Technology']:, ['Finance']: but i want Technology, Finance without the [''] around it. </p>

<p>By using <a href="https://docs.python.org/2/library/functions.html#str" rel="nofollow"><code>str</code></a>, you're printing a Python string representation of <code>description_title</code> (which is a <code>list</code> of length 1).  Try without the <code>str</code>:</p>

<pre><code>'&lt;h3 align="Center"&gt;' + description_title[0] + ": " + '&lt;/h3\n&gt;'
</code></pre>

python html regex