tempfile.gettempdir()
tempfile.gettempdir() is a Python function in the Tempfile Module category. Returns the path to the system default temporary directory. The syntax is tempfile.gettempdir(). Returns: String path. A typical example: tempfile.gettempdir() # "/tmp" or "C:\\Temp". A close sibling is tempfile.TemporaryFile(), which creates a temporary file that is automatically deleted when closed. A close sibling is tempfile.NamedTemporaryFile(), which creates a temporary file with a visible name in the filesystem. A close sibling is tempfile.mkstemp(), which creates a temporary file and returns a (fd, path) tuple. Caller must close and delete. A close sibling is tempfile.mkdtemp(), which creates a temporary directory that persists after creation. More about this category: Temporary file and directory creation — TemporaryFile, mkstemp, mkdtemp. Related Tempfile Module entries: tempfile.TemporaryFile(), tempfile.NamedTemporaryFile(), tempfile.mkstemp(), tempfile.mkdtemp(), tempfile.TemporaryDirectory(), tempfile.tempdir. This page is part of the free Python Reference documentation covering 978+ functions, methods, and modules with examples and parameter details.