Show updated text file in python
<p>Below is my python code:</p>

<pre><code>filename = 'ToDo.txt'
def preview():
    temp = open(filename, 'r')
    print temp.read()
    print '\n'
    temp.close

def new_task():
    temp = open(filename, 'a')
    while True:
        new_entry = raw_input('Enter New Task: ')
        if new_entry == 'exit' or new_entry == 'quit':
            break
        if new_entry == 'preview':
            print '\n'
            preview()
            break
        temp.write(new_entry + '\n')
        temp.close
</code></pre>

<p>I think it should display modified file with new entry saved if input is "preview", but it doesn't. Any idea to do the same.</p>
