title: Printing species name from fasta file heading in an output file using biopython (for multiple files)
body: <p>I'm having trouble printing the species name from my fasta files</p>
  
  <p>The input file is this:</p>
  
  <pre><code>&gt;NP_842573.1 chromosomal replication initiator DnaA [Bacillus anthracis str. Ames]
  MENISDLWNSALKELEKKVSKPSYETWLKSTTAHNLKKDVLTITAPNEFARDWLESHYSELISETLYDLTGAKLAIRFIIPQSQAEEEIDLPPAKPNAAQDDSNHLPQSMLNPKYTFDTFVIGSGNRFAHAASLAVAEAPAKAYNPLFIYGGVGLGKTHLMHAIGHYVIEHNPNAKVVYLSSEKFTNEFINSIRDNKAVDFRNKYRNVDVLLIDDIQFLAGKEQTQEEFFHTFNALHEESKQIVISSDRPPKEIPTLEDRLRSRFEWGLITDITPPDLETRIAILRKKAKAEGLDIPNEVMLYIANQIDSNIRELEGALIRVVAYSSLINKDINADLAAEALKDIIPNSKPKIISIYDIQKAVGDVYQVKLEDFKAKKRTKSVAFPRQIAMYLSRELTDSSLPKIGEEFGGRDHTTVIHAHEKISKLLKTDTQLQKQVEEINDILK
  </code></pre>
  
  <p>And a section of my output file looks like this (GCF...faa is the file name)</p>
  
  <pre><code>Y,2.798738459583378,GCF_000014005.1_ASM1400v1_protein.faa
  </code></pre>
  
  <p>I'd really like to print the species name [Bacillus anthracis str. Ames] as well as the file name.</p>
  
  <p>The line which I need to edit is this:</p>
  
  <pre><code>file.write ('\nY,' + str(pY) +  ',' + str(FILE))
  </code></pre>
  
  <p>Which prints a couple of variables and then the string of the file name.</p>
  
  <p>But I'm struggling to find a way of outputting the string between the square brackets in the header of the fasta file, using biopython.</p>