On 9 fév, 04:02, "Gabriel Genellina" <[EMAIL PROTECTED]> wrote: > En Thu, 08 Feb 2007 23:32:50 -0300, Sick Monkey <[EMAIL PROTECTED]> > escribió: > > > db = {'[EMAIL PROTECTED]':'none', '[EMAIL PROTECTED]':'none', > > '[EMAIL PROTECTED]':'none', > > '[EMAIL PROTECTED]':'none',} > > > And I want to pull out all of the "gmail.com" addresses.. How would I do > > this? > > > NOTE: I already have a regular expression to search for this, but I feel > > that looping over a dictionary is not very efficient.
(answer to the OP) Looping over a dict keys should be quite fast. If you're worried about perfs, it would be better to first get rid of useless regexps: filtered_db = dict((k, v) for k, v in db.iteritems() \ if not k.endswith('@gmail.com')) -- http://mail.python.org/mailman/listinfo/python-list