You also may want to check out Python's [tempfile module in the standard library](http://docs.python.org/2/library/tempfile.html)