import os def test(): if 'PATH' not in os.environ: print "not" else: print "yes" test() test() junk=os.environ test() os.environ test()