title: Python “List” object is not callable?
body: <p>I am trying to run this code where I use regular expression and dict(). I need to put the matching elements into the right list,but I get the error.TypeError: 'list' object is not callable. Can anyone tell me what am I doing wrong here.</p>
  
  <pre><code>dir='newDSSP'
  for tname in os.listdir(dir):
      file=dir+os.sep+tname
      ndfile=open(file)
      tname=dict()
      tname.setdefault('A',[[],[]])
      tname.setdefault('B',[[],[]])
      tname.setdefault('C',[[],[]])
      tname.setdefault('D',[[],[]])
      for ndline in ndfile:
          t=re.match(r'(\s+|\S+)+\t\w+\t(\w)\t(\w)\t(\w|\s)', ndline)
          k=t.group(2)
          if k =='A':
  
              tname['A'](0).append(t.group(3))&lt;--- **#Error here**
              tname['A'](1).append(t.group(4))
          elif k =='B':
  
              tname['B'](0).append(t.group(3))
              tname['B'](1).append(t.group(4))
          elif k =='C':
  
              tname['C'](0).append(t.group(3))
              tname['C'](1).append(t.group(4))
          elif k =='D':
  
              tname['D'](0).append(t.group(3))
              tname['D'](1).append(t.group(4))
      ndfile.close()
  </code></pre>