Converting integer tuple to float
<p>I have a tuple of integers. In reality, this is no tuple at all but a decimal number that all languages except English represent as <em>1,2</em> while English uses <em>1.2</em>. This "tuple" is read from a file and added into an array along with a series of integers, so the data type is automatically assigned by Python and I have no influence over it...</p>

<pre><code>whatever[7] = 1,2
</code></pre>

<p>Is there some clever way of converting this to 1.2? I found ways but they only work on strings but when I convert this to string, it is parenthesised and split by a space,</p>

<pre><code>str(whatever[7])
'(1, 2)'
</code></pre>

<p>...so the task gets expanded to getting rid also of "(", ")" and space, which is certainly feasible:</p>

<pre><code>str(str(str(str(whatever[7]).replace(",",".")).replace(" ","")).replace("(", "")).replace(")","")
</code></pre>

<p>...but it does not exactly strike me with its beauty and elegance.</p>

<p>The below format will work with your given example.</p>

<pre><code>whatever[7] = 1, 2
new_num = float("{}.{}".format(whatever[7][0], whatever[7][1]))
</code></pre>

python python-3.x data-type-conversion