title: Python: format negative number with parentheses
body: <p>Is there a way to use either string interpolation or <code>string.format</code> to render negative numbers into text formatted using parentheses instead of "negative signs"?</p>
  
  <p>I.e. <code>-3.14</code> should be <code>(3.14)</code>.</p>
  
  <p>I had hoped to do this using string interpolation or <code>string.format</code> rather than needing an import specifically designed for currencies or accounting.</p>
  
  <p>Edit to clarify: Please assume the variable to be formatted is either an <code>int</code> or a <code>float</code>.  I.e. while this can be done with regular expressions (see good answers below), I was thinking this would be a more native operation for Python's formatting functionality.</p>
  
  <p>So to be clear:</p>
  
  <pre><code>import numpy as np
  list_of_inputs = [-10, -10.5, -10 * np.sqrt(2), 10, 10.5, 10 * np.sqrt(2)]
  for i in list_of_inputs:
      # your awesome solution goes here
  </code></pre>
  
  <p>should return:</p>
  
  <pre><code>(10)
  (10.5)
  (14.14)
  10
  10.5
  14.14
  </code></pre>
  
  <p>Clearly there is some flexibility about that last one.  I had hoped the "put negative numbers in parentheses" would be a natural argument of string interpolation or <code>string.format</code> so that I could use other formatting language while setting the display style of negative numbers.</p>