If found brackets found in string, then remove brackets and data inside brackets
<p>I would like to detect brackets in a string, and if found, remove the brackets and all data in the brackets</p>

<p>e.g.</p>

<p><code>Developer (12)</code></p>

<p>would become</p>

<p><code>Developer</code></p>

<p>Edit: Note that the string will be a different length/text each time, and the brackets will not always be present.</p>

<p>I can detect the brackets using something like</p>

<pre><code>if '(' in mystring: 
   print 'found it'
</code></pre>

<p>but how would I remove the <code>(12)</code>?</p>

<p>You can user regex and replace it:</p>

<pre><code>&gt;&gt;&gt; re.sub(r'\(.*?\)', '','Developer (12)')
'Developer '
&gt;&gt;&gt; a='DEf (asd () . as ( as ssdd (12334))'
&gt;&gt;&gt; re.sub(r'\(.*?\)', '','DEf (asd () . as ( as ssdd (12334))')
'DEf  . as )'
</code></pre>

python regex