Create A Temporary File
Libraries¶
In [1]:
import tempfile
Create a temporary file¶
In [9]:
temp_file = tempfile.NamedTemporaryFile()
temp_file.name
Out[9]:
In [23]:
!ls -a /var/folders/9_/tl0k78wd62xchzsh_4x4bz0h0000gn/T/ | grep tmp7
Createa a temporary directory¶
In [8]:
temp_dir = tempfile.TemporaryDirectory()
temp_dir.name
Out[8]:
In [19]:
!ls /var/folders/9_/tl0k78wd62xchzsh_4x4bz0h0000gn/T/ | grep tmpje
Comments
Comments powered by Disqus