Maybe you need unique temporary file?
import tempfile
f = tempfile.NamedTemporaryFile(mode='w+b', delete=False)
print f.name
f.close()
f is opened file. delete=False
means do not delete file after closing.
If you need control over the name of the file, there are optional prefix=...
and suffix=...
arguments that take strings. See https://docs.python.org/3/library/tempfile.html.