title: Return value from 2D array in Python class
body: <p>I'll frame this in the fact that I'm kind of a newbie to Python and I'm taking my first stab at writing a class. What I'd like to achieve is for the class to open a text file and return a value from the file based on user input. The text file contains information in a 2D array like this:</p>
  
  <pre><code> 20,21,22
   23,24,25
   26,27,28
  </code></pre>
  
  <p>The value is retrieved from this text file and assigned to a new variable, so that the variable can be printed and also used later in a calculation. I've been able to do this without difficulty outside of a class, but getting this to work in a class has been frustrating. Here's the code I have so far in Python 2.7: </p>
  
  <pre><code>im_new = []
  
  class Read(object):
      def __init__(self, row, col, newvar):
          self.row = row
          self.col = col
          self.newvar = newvar
  
          display_list = []
          self.newvar = []
  
          with open("Array.txt", "r") as data_file:
              for line in data_file:
                  display_list.append(line.strip().split(','))
  
      def __str__(self):
          self.newvar = (display_list[self.row][self.col])
          return self.newvar
  
  immem = Read( 1, 1, im_new)
  
  
  print "OUTPUT: ", im_new
  </code></pre>
  
  <p>Ideally, I'd get "OUTPUT: 24", but instead I get "OUTPUT: []".  I'm not sure what I'm doing wrong.  Any help would be appreciated.</p>