title: Converting a string to a list of 2-tuples
body: <p>I have strings of this shape:</p>
  
  <pre><code>d="M 997.14282,452.3622 877.54125,539.83678 757.38907,453.12006 802.7325,312.0516 950.90847,311.58322 Z"
  </code></pre>
  
  <p>which are <code>(x, y)</code> coordinates of a pentagon (the first and last letters are metadata and to be ignored). What I want is a list of 2-tuples that would represent the coordinates in floating points without all the cruft:</p>
  
  <pre><code>d = [(997.14282, 452.3622), (877.54125, 539.83678), (757.38907, 453.12006), (802.7325,312.0516), (950.90847, 311.58322)]
  </code></pre>
  
  <p>Trimming the string was easy:</p>
  
  <pre><code>&gt;&gt;&gt; d.split()[1:-2]
  ['997.14282,452.3622', '877.54125,539.83678', '757.38907,453.12006', '802.7325,312.0516']
  </code></pre>
  
  <p>but now I want to create the tuples in a succinct way. This obviously didn't work:</p>
  
  <pre><code>&gt;&gt;&gt; tuple('997.14282,452.3622')
  ('9', '9', '7', '.', '1', '4', '2', '8', '2', ',', '4', '5', '2', '.', '3', '6', '2', '2')
  </code></pre>
  
  <p>Taking the original string, I could write something like this:</p>
  
  <pre><code>def coordinates(d):
      list_of_coordinates = []
      d = d.split()[1:-2]
      for elem in d:
          l = elem.split(',')
          list_of_coordinates.append((float(l[0]), float(l[1])))
      return list_of_coordinates
  </code></pre>
  
  <p>which works fine:</p>
  
  <pre><code>&gt;&gt;&gt; coordinates("M 997.14282,452.3622 877.54125,539.83678 757.38907,453.12006 802.7325,312.0516 950.90847,311.58322 Z")
  [(997.14282, 452.3622), (877.54125, 539.83678), (757.38907, 453.12006), (802.7325, 312.0516)]
  </code></pre>
  
  <p>However this processing is a small and trivial part of a bigger program and I'd rather keep it as short and succinct as possible. Can anyone please show me a less verbose way to convert the string to the list of 2-tuples? </p>