En Thu, 26 Apr 2007 03:56:17 -0300, John Nagle <[EMAIL PROTECTED]> escribió:
>>>>> On Tue, 2007-04-24 at 18:28 +0100, Robert Rawlins - Think Blue wrote: >>>>>> I'm Looking to build a quick if/else statement that checks a >>>>>> dictionary for a key like follows. > > It would be useful if there was some direct way to get the value > associated with a key, and None if there's not one. Such wonderful method exists since immemorial ages -at least since Python 1.5- and its magic name is "get": py> d = {'a': 1, 'b': 2} py> print d.get("a") 1 py> print d.get("z") None -- Gabriel Genellina -- http://mail.python.org/mailman/listinfo/python-list