How can I create a temporary directory and get its path/file name in Python?
Use the mkdtemp() function from the tempfile module:
mkdtemp()
tempfile
import tempfile import shutil dirpath = tempfile.mkdtemp() # ... do stuff with dirpath shutil.rmtree(dirpath)
1.4m articles
1.4m replys
5 comments
57.0k users