title: Unable to append to a list
body: <p>Background:
  I've a text files that has inputs like:</p>
  
  <pre><code>#1 GLN 15.A OE1
  #1 ILE 16.A C
  #1 ILE 16.A CA
  #1 ILE 16.A CB
  #1 ILE 16.A CD1
  </code></pre>
  
  <p>I convert this file into a string in python. And I get the outputs (say numbers) I want to.</p>
  
  <p>A part of the code is here:</p>
  
  <pre><code>def extractnum(s):
     x = s.split('\n')
     x.pop() #To remove last line which is empty
     y = [ i.split() for i in x ]
     z = [ j[2] for j in y ] #z is the list that contains the residue and chain information
     n = [int(k.split('.')[0]) for k in z]
     a_chain_residues = ''
     ca_a_chain_residues = ''
     list_of_a_chain_residues = [ ]
     for i in list(set(z)): #list(set(z)) gives a list that removes all the duplicate items in z: it doesn't change z
        if i[-1] == 'A':
            a_chain_residues = a_chain_residues + i +','
            ca_a_chain_residues = ca_a_chain_residues + i + '.ca,'
            list_of_a_chain_residues = list_of_a_chain_residues.append(i)
        print list_of_a_chain_residues
  </code></pre>
  
  <p>The error in terminal reads</p>
  
  <pre><code>extractnum(s)
  Traceback (most recent call last):
  File "&lt;stdin&gt;", line 1, in &lt;module&gt;
  File "&lt;stdin&gt;", line 17, in extractnum
  AttributeError: 'NoneType' object has no attribute 'append'
  </code></pre>
  
  <p>Why can't 'i' add to a list? Is there a way to fix this?</p>