Python / tempfile === ###### tags: `Python` ###### tags: `Python`, `tempfile`, `TemporaryDirectory`, `cleanup`, `建立暫存目錄` <br> [TOC] <br> ```python= import tempfile tmp = tempfile.TemporaryDirectory() try: # do something cache_dir=tmp.name # ... finally: tmp.cleanup() ``` - `tmp` `<TemporaryDirectory '/tmp/tmpf8aqwtak'>` <br> {%hackmd vaaMgNRPS4KGJDSFG0ZE0w %}