title: How do I convert a string to a Python Decimal in German locale (with comma instead of a point)
body: <p>I'm trying to convert a string to a python decimal.</p>
  
  <p>This works</p>
  
  <pre><code>from decimal import *
  mystr = '123.45'
  print(Decimal(mystr))
  </code></pre>
  
  <p>But when I want to use the thousand separator and the locale, it doesn't.
  Converting to float works fine.</p>
  
  <pre><code>from locale import *
  setlocale(LC_NUMERIC,'German_Germany.1252')
  from decimal import *
  mystr = '1.234,56'
  print(atof(mystr))
  print(Decimal(mystr))
  </code></pre>
  
  <p>returns the float and an error</p>
  
  <pre><code>1234.56
  InvalidOperation: [&lt;class 'decimal.ConversionSyntax'&gt;] 
  </code></pre>
  
  <p>Is there a right way to convert the string without manually transforming it via float or hackier solutions? FYA, my current hacky solution is:</p>
  
  <pre><code> print(Decimal(f'{atof(mystr):2.2f}'))
  </code></pre>