Thanks guys for this, glad it was so simple.
I used mikes solution in the end, and it worked a charm. Thanks again, Rob From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Michael Bentley Sent: 24 April 2007 18:37 To: python-list@python.org Subject: Re: If Dict Contains a particular key On Apr 24, 2007, at 12:28 PM, Robert Rawlins - Think Blue wrote: Hello Guys, I'm Looking to build a quick if/else statement that checks a dictionary for a key like follows. If myDict contains ThisKey: Do this... Else Do that... Thats the best way of doing this? if ThisKey in myDict: pass # do this else: pass # do that
-- http://mail.python.org/mailman/listinfo/python-list