Writing to file overwrites the contents <p>So when I run this code it works perfectly, but it overwrites the previous times in the <code>stopwatch_times.txt</code> so, I searched high and low but <code>couldn't</code> find out how to do it.</p> <pre><code>#!/usr/bin/python import time var_start = input("Press Enter To START The stopwatch") t0 = time.time() var_stop = input("Press Enter to STOP The stopwatch") stopwatch_time = round(time.time() - t0,2) stopwatch_time = str(stopwatch_time) file_ = open("stopwatch_times.txt") with open('stopwatch_times.txt', 'w') as file_: file_.write(stopwatch_time) print ("Stopwatch stopped - Seconds Elapsed : ",round(time.time() - t0,2)) </code></pre>