Using "temp files" folder in python
I recently wrote a script that asks PyPI and downloads a package; however, the package is downloaded to a custom folder.
I would like to modify the script so that my downloaded files go into a temp folder if no folder is specified.
Temporary files folder in * nix machines - "/ tmp"; was there any Python method I could use to find out the temp folder on a specific machine?
If not, can anyone suggest an alternative to this problem?
+2
user277465
a source
to share
2 answers
Python has a built-in module for using temporary files and folders. You probably want to tempfile.mkdtemp()
.
+7
a source to share