Writing to txt in python <p>I'm writing lines of numbers to a text file from another text file. The numbers that print while this is running look good, but when I open the output file nothing has been written to it. Can't figure out why.</p> <pre><code>min1=open(output1,"w") oh_reader = open(filename, 'r') countmin = 0 while countmin &lt;=300000: for line in oh_reader: #min1 if countmin &lt;=60000: hrvalue= int(line) ibihr = line print(line) print(countmin) min1.write(ibihr) min1.write("\n") countmin = countmin + hrvalue min1.close() </code></pre>