Why I can't read anything with File.open in python when I open the file to write first?
<pre><code>f = open('day_temps.txt','w')
f.write("10.3,10.1,9.9,9.9,9.8,9.6,9.0,10.1,10.2,11.1")
f.close

def get_stats(file_name):
    temp_file = open(file_name,'r')
    temp_array = temp_file.read().split(',')
    number_array = []
    for value in temp_array:
        number_array.append(float(value))
    number_array.sort()
    max_value = number_array[-1]
    min_value = number_array[0]
    sum_value = 0
    for value in number_array:
        sum_value += value
    avg_value = sum_value / len(number_array)
    return min_value, max_value, avg_value

mini, maxi, mean = get_stats('day_temps.txt')
print "({0:.5}, {1:.5}, {2:.5})".format(mini, maxi, mean)
</code></pre>

<p>without the <code>first 3 line</code>, the code works, with it I can't read nothing in the <code>temp_file</code>, I don't get it, any idea?</p>
