On Thu, Apr 24, 2008 at 11:13:25AM +0300, bvidinli wrote:
> if conf.has_key('key1'):
>      if conf['key1']<>'':
>          other commands....
> 
> this is very annoying.
> in php, i was able to code only like:
> if conf['key1']=='someth'
> 
> in python, this fails, because, if key1 does not exists, it raises an 
> exception.

if conf.get('key1')=='someth':...

PS. Please do not cross-post so extensively.

Oleg.
-- 
     Oleg Broytmann            http://phd.pp.ru/            [EMAIL PROTECTED]
           Programmers don't die, they just GOSUB without RETURN.
--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to