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>Since it's always at the end and there is no nested brackets:</p>

<pre><code>s = "Developer (12)"
s[:s.index('(')]  # or s.index(' (') if you want to get rid of the previous space too
</code></pre>

python regex