How to test with Python if str variable contains number (int,float) or non-numeric str
<p>If a Python string variable has had either an integer, floating point number or a non-numeric string placed in it, is there a way to easily test the "type" of that value?</p>

<p>The code below is real (and correct of course):</p>

<pre><code>&gt;&gt;&gt; strVar = "145"
&gt;&gt;&gt; print type(strVar)
&lt;type 'str'&gt;
&gt;&gt;&gt;
</code></pre>

<p>but is there a Python function or other method that will enable me to return 'int' from interrogating strVar set as above</p>

<p>Perhaps something like the nonsense code and results below ...</p>

<pre><code>&gt;&gt;&gt; print typeofvalue(strVar)
&lt;type 'int'&gt;
</code></pre>

<p>or more nonsense:</p>

<pre><code>&gt;&gt;&gt; print type(unquote(strVar))
&lt;type 'int'&gt;
</code></pre>
