There are two general approaches. Outside of python:
python your_program.py >output_file.txt
Or, inside of Python:
out = open("output_file.txt", "w")
for alignment in blast_record.alignments:
for hsp in alignment.hsps:
print >>out, '>', alignment.title
print >>out, hsp.sbjct
out.close()