ID EN
Tempfile

mkstemp

Python 3.11

Creates a temporary file in the most secure manner possible. There are no race conditions in the file’s creation, assuming that the platform properly implements the os.O_EXCL flag for os.open(). The file is readable and writable only by the creating user ID. If the platform uses permission bits to indicate whether a file is executable, the file is executable by no one. The file descriptor is not inherited by child processes.

Syntax

PYTHON
tempfile.mkstemp(suffix=None, prefix=None, dir=None, text=False)

See Also

os.O_EXCL os.open() TemporaryFile() mkstemp() mkstemp() gettempprefix() gettempprefixb() mkstemp()