title: Delete lines starting with a unique number
body: <p>I'm learning Python and created this program, but it won't work and I'm hoping someone can find the error!</p>
  
  <p>I have a file that has entries like this:</p>
  
  <pre><code>0 Kurthia sibirica Planococcaceae   
  1593 Lactobacillus hordei Lactobacillaceae   
  1121 Lactobacillus coleohominis Lactobacillaceae   
  614 Lactobacillus coryniformis Lactobacillaceae   
  57 Lactobacillus kitasatonis Lactobacillaceae   
  3909 Lactobacillus malefermentans Lactobacillaceae
  </code></pre>
  
  <p>My goal is to remove all the lines that start with a number that only occurs once in the whole file (unique numbers), and save all the lines that start with number occurring twice or more to a new file. This is my attempt. It doesn't work yet (when I let the <code>print</code> line work, one line from the whole files repeated 3 times and that's it):</p>
  
  <pre><code>#!/usr/bin/env python
  
  infilename = 'v35.clusternum.species.txt'
  outfilename = 'v13clusters.no.singletons.txt'
  
  #remove extra letters and spaces
  x = 0
  with open(infilename, 'r') as infile, open(outfilename, 'w') as outfile:
          for line in infile:
                  clu, gen, spec, fam = line.split()
          for clu in line:
                  if clu.count &gt; 1:
                          #print line
                          outfile.write(line)
                  else:
                      x += 1
  print("Number of Singletons:")
  print(x)
  </code></pre>
  
  <p>Thanks for any help!</p>