Michele Petrazzo wrote: > Hi ng, > what the preferred way for see if the dict has a key? > We have a lot of solutions: > > key in dict > key in dict.keys() > dict.has_key(key) > ...
try: dict[key] except KeyError: ... else: ... > but what the better Depends on the context. -- bruno desthuilliers python -c "print '@'.join(['.'.join([w[::-1] for w in p.split('.')]) for p in '[EMAIL PROTECTED]'.split('@')])" -- http://mail.python.org/mailman/listinfo/python-list