title: Converting String to List
body: <blockquote>
    <p><strong>Possible Duplicate:</strong><br>
    <a href="https://stackoverflow.com/questions/5214344/converting-a-string-that-represents-a-list-into-an-actual-list-object">Converting a string that represents a list, into an actual list object.</a>  </p>
  </blockquote>
  
  
  
  <p>hi,</p>
  
  <p>i have a string in this format:</p>
  
  <pre><code>&gt;&gt;&gt; x="(174,185)"
  &gt;&gt;&gt; x
  '(174,185)'
  </code></pre>
  
  <p>how can i convert this string to list so that i can access the index 0 as 174 and index 1 as 185? i'm using Python 2.5 &amp; Win XP.
  i tried a few ways but it doesn't work well. appreciate your advice. tq</p>
  
  <pre><code>&gt;&gt;&gt; y=x.split(",")
  &gt;&gt;&gt; y
  ['(174', '185)']
  &gt;&gt;&gt; y[0]
  '(174'
  &gt;&gt;&gt; [int(x) for x in x.split(",")]
  Traceback (most recent call last):
    File "&lt;pyshell#18&gt;", line 1, in &lt;module&gt;
      [int(x) for x in x.split(",")]
  ValueError: invalid literal for int() with base 10: '(174'
  &gt;&gt;&gt; 
  </code></pre>