Q:

Not writing to text file when running module in IDLE

I'm trying to learn Python for some bioinformatics/biology related type of research. I don't have a lot of programming experience outside of Java - which is very limited. I'm currently trying to use python to create a text file and write something into it. I'm able to do this, but when I select "run module" in IDLE, the text files are created, but there isn't any text. However, when I actually run the file outside of IDLE, the files are created with the text. What is the reason for this?
Edit:
Here's the code (it's based off of an exercise from a textbook I'm using):
genomic_dna_file = open("genomic_dna.txt")
genomic_dna = genomic_dna_file.read()

exon1 = genomic_dna[0:63]
exon2 = genomic_dna[90:]
coding = exon1 + exon2
noncoding = genomic_dna[63:90]

coding_file = open('coding.txt', 'w')
noncoding_file = open('noncoding.txt', 'w')
coding_file.write(coding)
noncoding_file.write(noncoding)

A:

The problem may be due to not closing the files in python code. Since the file is open in IDLE the changes in the files are not seen. You could use  close()  method to close the files. 
genomic_dna_file = open("genomic_dna.txt")
genomic_dna = genomic_dna_file.read()
genomic_dna_file.close()

exon1 = genomic_dna[0:63]
exon2 = genomic_dna[90:]
coding = exon1 + exon2
noncoding = genomic_dna[63:90]

coding_file = open('coding.txt', 'w')
noncoding_file = open('noncoding.txt', 'w')
coding_file.write(coding)
noncoding_file.write(noncoding)
coding_file.close()
noncoding_file.close()

Generally, it's a good practice to always close and free the resources when you don't need them.

