I'm writing a python code that will store data temporarily. In a unix like system I know of \tmp
directory but can't figure out how to that for windows.
Sample Code:
import os
if os.name == 'nt':
temp_directory = ''
elif os.name == 'posix':
temp_directory = '/tmp/'
Do I use something like temp_directory = '%Temp%'
?
Edit:
The gettempdir()
function from the tempfile
module is what I was looking for.