all Python 3tempfilefunction
tempfile.gettempprefix()
directories and paths
Returns the prefix that default temporary file names start with, usually 'tmp'.
Syntax
tempfile.gettempprefix() -> str
The prefix contains no directory separator and is used only when prefix=None. To make your temporary files easy to find and clean up, pass a meaningful prefix='myapp_' instead of the default 'tmp'.
Examples
import os, tempfile
print(tempfile.gettempprefix()) # → tmp
with tempfile.NamedTemporaryFile() as f:
print(os.path.basename(f.name)[:3]) # → tmp
See also
Open in the full glossarydocs.python.orgReport an inaccuracy