python - extract coordinates from a variable string
<p>I have a latitude and longitude that come in a string like this:</p>

<pre><code>my_string ='(31.251, -98.877)'
</code></pre>

<p>I would like to use Python to extract the coordinates from the above string. </p>

<p>The problem is that sometimes the string has variable length so one time it might look like this <code>(31.25134, -98.877)</code> or <code>(31.25134, -98.877435)</code>. </p>

<p>So if I do something like <code>my_string[9:15]</code> to extract the last number (the longitude) if the first number (the latitude) is longer I capture the  ')' too and that's not good.</p>

<p>Any idea how I might be able to extract those coordinates correctly from that string?
Thank you!</p>
