title: Passing a file to a class
body: <p>First time writing a class here and I need a little help. </p>
  
  <p>I've been trying to write a class in which the first takes a tab-delimited csv file and outputs a list of dictionaries. Each of the keys in the dictionary is a column title in the csv.</p>
  
  <p>So far, this is what my class looks like:</p>
  
  <pre><code>import csv
  
  class consolidate(object):
  
      def __init__(self, file):
          self.file = file
  
      def create_master_list(self):
          with(open(self,'rU')) as f:
              f_d = csv.DictReader(f, delimiter = '\t')
              m_l = []
              for d in f_d:
                  m_l.append(d)
          return m_l
  </code></pre>
  
  <p>When I try to pass it a file, as follows:</p>
  
  <pre><code>c = consolidate()
  a = c.create_master_list('Abilities.txt')
  </code></pre>
  
  <p>I get the following error:</p>
  
  <pre><code>TypeError: __init__() takes exactly 2 arguments (1 given)
  </code></pre>
  
  <p>I know that what I want to pass a file argument to the <code>create_master_list</code> function, but I'm unsure what the right syntax to do this is.</p>
  
  <p>I've tried <code>self.file</code> and <code>file</code> as arguments, and both do not work as well.</p>
  
  <p>Thanks!</p>