tempfile.mkstemp() returns:
a tuple containing an OS-level handle to an open file (as would be returned by os.open()) and the absolute pathname of that fi
temp = tempfile.NamedTemporaryFile(delete=False) temp.file.write('foo\n') temp.close()