> 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 key in myDict:
    Do this.....
else:
    Do that....


HTH,
Daniel
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to