title: Appending random True or False to the end of each line in Python
body: <p>I have a text file that is organized into lines and columns. Here is a sample of the file </p>
  
  <pre><code>ATOM      1  N   MET A   0       7.721  14.287  22.993  1.00 56.77           N  
  ATOM      2  CA  MET A   0       8.721  15.393  22.939  1.00 56.81           C  
  ATOM      3  C   MET A   0      10.044  14.985  23.585  1.00 54.96           C  
  ATOM      4  O   MET A   0      11.059  15.660  23.408  1.00 56.23           O  
  ATOM      5  CB  MET A   0       8.167  16.640  23.642  1.00 59.72           C  
  ATOM      6  CG  MET A   0       7.207  16.349  24.796  1.00 62.33           C  
  ATOM      7  SD  MET A   0       5.772  17.459  24.822  1.00 66.48           S  
  </code></pre>
  
  <p>What I want to do is to add a <strong>random</strong> true or false to the end of each line, ideally in its own column, something that looks like this</p>
  
  <pre><code>ATOM      1  N   MET A   0       7.721  14.287  22.993  1.00 56.77           N    True
  ATOM      2  CA  MET A   0       8.721  15.393  22.939  1.00 56.81           C    False
  ATOM      3  C   MET A   0      10.044  14.985  23.585  1.00 54.96           C    False
  ATOM      4  O   MET A   0      11.059  15.660  23.408  1.00 56.23           O    False
  ATOM      5  CB  MET A   0       8.167  16.640  23.642  1.00 59.72           C    True
  ATOM      6  CG  MET A   0       7.207  16.349  24.796  1.00 62.33           C    False
  ATOM      7  SD  MET A   0       5.772  17.459  24.822  1.00 66.48           S    False
  </code></pre>
  
  <p>Here is the function that I have written to try to accomplish this</p>
  
  <pre><code>def random_TF(pdbFileName): #This function will randomly generate TRUE or FALSE
      with open(pdbFileName, 'r') as e:
          with open('1fkqTF.txt', 'w') as f:
              for i, line in enumerate(e):
                  line = line.rstrip('\n')
                  line += str(random.choice([True, False]))
  
      e.close()
      f.close()
  </code></pre>
  
  <p>However, when I call the function it returns a blank text file. </p>