Delete common entries between two dictionaries

Aahz aahz at pythoncraft.com
Tue Nov 25 00:25:33 CET 2003


In article <7x8ym55t3x.fsf at ruckus.brouhaha.com>,
Paul Rubin  <http://phr.cx@NOSPAM.invalid> wrote:
>"Amy G" <amy-g-art at cox.net> writes:
>>
>> Now that I have the two, I want to delete each entry from one that the two
>> have in common, leaving only those that are unique to the dictionary?
>> 
>> Say I have a dictionary called domains_black
>> and another domains_white...
>
>for k in domains_white():
>   if k in domains_black:
>      del domains_black[k]

Didja try that before posting?....  (I see at least two errors.)
-- 
Aahz (aahz at pythoncraft.com)           <*>         http://www.pythoncraft.com/

Weinberg's Second Law: If builders built buildings the way programmers wrote 
programs, then the first woodpecker that came along would destroy civilization.




More information about the Python-list mailing list