title: How to convert a string to a complex number in Python?
body: <p>I'm trying to convert an input string to a float but when I do it I keep getting some kind of error, as shown in the sample below.</p>
  <pre class="lang-none prettyprint-override"><code>&gt;&gt;&gt; a = &quot;3 + 3j&quot;
  &gt;&gt;&gt; b = complex(a)
  Traceback (most recent call last):
    File &quot;&lt;stdin&gt;&quot;, line 1, in &lt;module&gt;
  ValueError: complex() arg is a malformed string
  </code></pre>