>>> import os>>> 'HOME' in os.environ # Check an existing env. variableTrue...
python2
>>> import os>>> os.environ.has_key('HOME') # Check an existing env. variableTrue>>> os.environ.has_key('FOO') # Check for a non existing variableFalse>>> os.environ['FOO'] = '1' # Set a new env. variable (String value)>>> os.environ.has_key('FOO')True>>> os.environ.get('FOO') # Retrieve the value'1'
# Will Set Persistent Value for Variable in System# * subkey works only for windows like file in folder# * reg_path works only for windows as register pathSysEnv.set_var(name, value, subkey, reg_path=default_reg_path)
# Will Get Persistent Value for Variable in System# * reg_path works only for windows as register path# * delete, deletes key from environment and its subkeys after readSysEnv.get_var(name, reg_path=default_reg_path, delete=False)