Temp File

import os
file = os.tmpfile()
---------------------------------------------------------------------------

AttributeError                            Traceback (most recent call last)

<ipython-input-6-ae7d4801123e> in <module>()
----> 1 file = os.tmpfile()


AttributeError: module 'os' has no attribute 'tmpfile'

Note: (Python 3)

The functions os.tmpnam(), os.tempnam() and os.tmpfile() have been removed in favor of the tempfile module.
import tempfile
fp = tempfile.TemporaryFile()
fp
<_io.BufferedRandom name=57>
fp.name
57
fp = tempfile.TemporaryFile()
fp.name
58