I got the solution. It worked fine in my Ubuntu. Please try this :)
from Bio import SeqIO
temp = {}
for line in open("test.txt","r"):
i, c = line.strip().split()
temp[i] = c
for rec in SeqIO.parse("mymodified_transcript.fa","fasta"):
if str('>'+rec.id) in temp.keys():
print str('>'+rec.id), temp['>'+rec.id]
print str(rec.seq)