title: How to read a text file into a list or an array with Python
body: <p>I am trying to read the lines of a text file into a list or array in python.  I just need to be able to individually access any item in the list or array after it is created.</p>
  
  <p>The text file is formatted as follows:</p>
  
  <pre><code>0,0,200,0,53,1,0,255,...,0.
  </code></pre>
  
  <p>Where the <code>...</code> is above, there actual text file has hundreds or thousands more items.</p>
  
  <p>I'm using the following code to try to read the file into a list:</p>
  
  <pre><code>text_file = open("filename.dat", "r")
  lines = text_file.readlines()
  print lines
  print len(lines)
  text_file.close()
  </code></pre>
  
  <p>The output I get is:</p>
  
  <pre><code>['0,0,200,0,53,1,0,255,...,0.']
  1
  </code></pre>
  
  <p>Apparently it is reading the entire file into a list of just one item, rather than a list of individual items.  What am I doing wrong?</p>