I have opened a file with blast results and printed out the hits in fasta format to the screen.
The code looks like this:
result_handle = open(\"/Use
for some reason the code above posted by OP did not work for me.. I modified a bit
from Bio.Blast import NCBIXML
f = open('result.txt','w')
for record in NCBIXML.parse(open("file.xml")) :
for alignment in record.alignments:
for hsp in alignment.hsps:
f.write(">%s\n"%alignment.title)
f.write(hsp.sbjct+"\n")