title: Python: Create coordinate list (convert string to int)
body: <p>I want to import several coordinates (could add up to 20.000) from an text file. 
  These coordinates need to be added into a list, looking like the follwing:</p>
  
  <pre><code>coords = [[0,0],[1,0],[2,0],[0,1],[1,1],[2,1],[0,2],[1,2],[2,2]]
  </code></pre>
  
  <p>However when i want to import the coordinates i got the follwing error:</p>
  
  <pre><code>invalid literal for int() with base 10
  </code></pre>
  
  <p>I can't figure out how to import the coordinates correctly. 
  Does anyone has any suggestions why this does not work?
  I think there's some problem with creating the integers.
  I use the following script:</p>
  
  <pre><code>Bronbestand = open("D:\\Documents\\SkyDrive\\afstuderen\\99 EEM - Abaqus 6.11.2\\scripting\\testuitlezen4.txt", "r")
  headerLine = Bronbestand.readline()
  valueList = headerLine.split(",")
  
  xValueIndex = valueList.index("x")
  #xValueIndex = int(xValueIndex)
  yValueIndex = valueList.index("y")
  #yValueIndex = int(yValueIndex)
  
  coordList = []
  
  for line in Bronbestand.readlines():
      segmentedLine = line.split(",")
      coordList.extend([segmentedLine[xValueIndex], segmentedLine[yValueIndex]])
  
  coordList = [x.strip(' ') for x in coordList]
  coordList = [x.strip('\n') for x in coordList]
  
  coordList2 = []
  #CoordList3 = [map(int, x) for x in coordList]
  
  for i in coordList:
      coordList2 = [coordList[int(i)], coordList[int(i)]]
  
  print "coordList = ", coordList
  print "coordList2 = ", coordList2
  #print "coordList3 = ", coordList3
  </code></pre>
  
  <p>The coordinates needed to be imported are looking like (this is "Bronbestand" in the script):</p>
  
  <pre><code>id,x,y,
        1,  -1.24344945,   4.84291601
        2,  -2.40876842,   4.38153362
        3,  -3.42273545,    3.6448431
        4,  -4.22163963,   2.67913389
        5,   -4.7552824,   1.54508495
        6,  -4.99013376, -0.313952595
        7,   -4.7552824,  -1.54508495
        8,  -4.22163963,  -2.67913389
        9,  -3.42273545,   -3.6448431
  </code></pre>
  
  <p>Thus the script should result in:</p>
  
  <pre><code>[[-1.24344945, 4.84291601],[-2.40876842, 4.38153362],[-3.42273545, 3.6448431],[-4.22163963, 2.67913389],[-4.7552824, 1.54508495],[-4.99013376,-0.313952595],[-4.7552824, -1.54508495],[-4.22163963, -2.67913389],[-3.42273545, -3.6448431]]
  </code></pre>
  
  <p>I also tried importing the coordinates with the native python csv parser but this didn't work either.</p>
  
  <p>Thank you all in advance for the help!</p>