Hi,
I'm the developer of pyGeno. pyGeno is designed to simplify this kind of operations and allow you to go further if needed. Here's an example that works for the Gene TPST2. Of course it would work for any other gene, and you could also loop through all the genes of the genome if you would like to:
from pyGeno.Genome import *
ref = Genome(name = "GRCh37.75")
gene = ref.get(Gene, name = "TPST2")[0]
#you can also make a query using the Ensembl Id
#gene = ref.get(Gene, id = "ENSG00000128294")[0]
exons = {}
for trans in gene.get(Transcript) :
for exon in trans.exons :
if exon.id not in exons :
exons[exon.id] = exon
print "Exons in common"
for e in exons :
print e
print 'whole sequence', e.sequence
print 'coding sequence', e.CDS
pyGeno uses Ensembl annotations.
Hope that helps.
Cheers