On this page
tempfile.gettempprefix
Prev: tempfile.gettempdirb | Up: tempfile | Next: tempfile.gettempprefixb
Rel: tempfile.gettempdir, tempfile.gettempdirb, tempfile.gettempprefixb, tempfile.mkdtemp
Ref: docs.python.org — tempfile.gettempprefix
Tags: #public #python3 #stdlib #tempfile
Import
import tempfile
from tempfile import gettempprefix
Signature & Overview
tempfile.gettempprefix()
The default prefix for temporary directories as string.
Usage
import tempfile
prefix = tempfile.gettempprefix()
assert isinstance(prefix, str) and len(prefix) > 0
Gotchas
- Prefix only, not a directory: Returns the default filename prefix (typically
"tmp"), not the temp folder path—usegettempdir()for the directory.
REPL Inspect
from tempfile import gettempprefix
help(gettempprefix)
Linked from
- tuts/python3/stdlib_module/tempfile
- tuts/python3/stdlib_module/tempfile/gettempdir
- tuts/python3/stdlib_module/tempfile/gettempdirb
- tuts/python3/stdlib_module/tempfile/gettempprefixb
- tuts/python3/stdlib_module/tempfile/mkdtemp
- tuts/python3/stdlib_module/tempfile/mkstemp
- tuts/python3/stdlib_module/tempfile/mktemp
- tuts/python3/stdlib_module/tempfile/NamedTemporaryFile
- tuts/python3/stdlib_module/tempfile/SpooledTemporaryFile
- tuts/python3/stdlib_module/tempfile/TemporaryDirectory
- tuts/python3/stdlib_module/tempfile/TemporaryFile
Related notes
- tuts/python3/stdlib_module/tempfile/gettempdir Linked here; links to this page; shared tags: #stdlib, #tempfile
- tuts/python3/stdlib_module/tempfile/gettempdirb Linked here; links to this page; shared tags: #stdlib, #tempfile
- tuts/python3/stdlib_module/tempfile/gettempprefixb Linked here; links to this page; shared tags: #stdlib, #tempfile
- tuts/python3/stdlib_module/tempfile/mkdtemp Linked here; links to this page; shared tags: #stdlib, #tempfile
- tuts/python3/stdlib_module/tempfile Linked here; links to this page; shared tags: #stdlib
- tuts/python3/stdlib_module/tempfile/mkstemp links to this page; shared tags: #stdlib, #tempfile
- tuts/python3/stdlib_module/tempfile/mktemp links to this page; shared tags: #stdlib, #tempfile
- tuts/python3/stdlib_module/tempfile/NamedTemporaryFile links to this page; shared tags: #stdlib, #tempfile
- tuts/python3/stdlib_module/tempfile/SpooledTemporaryFile links to this page; shared tags: #stdlib, #tempfile
- tuts/python3/stdlib_module/tempfile/TemporaryDirectory links to this page; shared tags: #stdlib, #tempfile