Python Forum

Full Version: How to get %appdata% directory?
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
I tried to get %appdata% directory,
But failed.

Script,
import os
print os.getenv('APPDATA')
Error:
File "C:\Users\User\AppData\Local\Temp\atom_script_tempfiles\db861f50-55af-11eb-b27a-c3d006aa3aaa", line 4 print os.getenv('APPDATA') ^ SyntaxError: invalid syntax
Im trying to save a cache file in %appdata% directory!
Owhh,
import os

direc =  os.getenv('APPDATA')
print(direc)
Py 2 and py 3 is different!