Message81965
>>> os.environ['FOO']
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/lib/python2.5/UserDict.py", line 22, in __getitem__
raise KeyError(key)
KeyError: 'FOO'
>>> os.environ.get('FOO')
>>> os.environ.get('FOO', 'bar')
'bar'
% export FOO=
% python2.5
>>> import os
>>> os.environ['FOO']
''
An environment variable set to '' is valid and is still considered set
(thats how the environment works). |
|
Date |
User |
Action |
Args |
2009-02-13 19:21:54 | gregory.p.smith | set | recipients:
+ gregory.p.smith, marystern |
2009-02-13 19:21:54 | gregory.p.smith | set | messageid: <1234552914.58.0.376500342624.issue5253@psf.upfronthosting.co.za> |
2009-02-13 19:21:53 | gregory.p.smith | link | issue5253 messages |
2009-02-13 19:21:52 | gregory.p.smith | create | |
|