First create an object file:
f = open("myfile.txt", "w") # Use "a" instead of "w" to append to file
You can print the file file:
print >> f, '>', alignment.title
print >> f, hsp.sbjct
Or you can write him:
f.write('> %s\n' % (alignment.title,))
f.write('%s\n' % (hsp.sbjct,))
Then you can close it to be nice:
f.close()
source
share