"wesley chun" <wes...@gmail.com> wrote in message [snip]
... however, there is a tiny bug: if the $HOME
environment variable is *not* set, you will get a KeyError exception.
one solution is to add a default value to your get() method call so
that it returns an object with a Boolean False value:

No KeyError.  Default on missing is to return None.

help(os.environ.get)
Help on method get in module os:

get(self, key, failobj=None) method of os._Environ instance

-Mark


_______________________________________________
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor

Reply via email to