title: How to convert multiple coordinates from DMS to decimal?
body: <p>I'm tryng to convert some coordinates from DMS to decimal.
  For example from <code>S1639 W07157</code> to <code>-16.65, -71.95</code>
  To achieve this I use the code found: <a href="https://en.proft.me/2015/09/20/converting-latitude-and-longitude-decimal-values-p/" rel="nofollow noreferrer">here</a> modified as below:</p>
  <pre><code>def dm2dd(direction, degrees, minutes):
      dd = round(float(degrees) + float(minutes)/60, 4);
      if direction == 'S' or direction == 'W':
          dd *= -1
      return dd
  
  def dd2dm(deg):
      d = int(deg)
      md = abs(deg - d) * 60
      m = int(md)
      return d, m
  
  def parse_dm(dm):
      parts = re.split('(\w)([0-9]{2})([0-9]{2})\s(\w)([0-9]{3})([0-9]{2})', dm)
      lat = dm2dd(parts[1], parts[2], parts[3])
      lng = dm2dd(parts[4], parts[5], parts[6])
      return lat, lng
  </code></pre>
  <p>Using this functions I can convert a couple of coordinates (for example <code>S1639 W07157</code>) without any problem, but sometimes I need to convert a string where multiple &quot;couple&quot; can be found (for example <code>S1549 W07150 - S1632 W07148 - S1653 W07154 - S1647 W07204 - S1630 W07156 - S1549 W07150</code>).
  How can I modify the code to get an output like:</p>
  <pre><code>-15.8167 -71.8333 -16.5333 -71.8 -16.8833 -71.9 -16.7833 -72.0667 -16.5 -71.9333 -15.8167 -71.8333
  </code></pre>