I'm in the Python shell and I'm trying to understand the basics. Here is what I have typed:

```
doc = open('test.txt', 'w') # this opens the file or creates it if it doesn't exist
doc.write('blah blah')
doc.truncate()

```

I understand the first line. However, in the second line, isn't it supposed to write 'blah blah' to the file? It doesn't do that. However, when I run a `truncate` function to the file, 'blah blah' suddenly shows up. Can someone explain to me how this logic works? 

I thought `truncate` was supposed to erase the contents of the file? Why does it make the previous `write` line show up?