removing items from a dictionary ?

Steven D'Aprano steve at REMOVE.THIS.cybersource.com.au
Sat Jul 28 02:43:17 CEST 2007


On Thu, 26 Jul 2007 21:38:31 +0200, martyw wrote:

> Remoing elements from a dict is done with del, try this;
>  >>> d = {'a' : 1,'b' : 2}
>  >>> del d['a']
>  >>> print d
> {'b': 2}
>  >>>
> 
> maybe you can post a working snippet to demonstrate your problem


Wow. This wins my award for the least helpful, while still being
technically correct, reply ever. Did you even read the Original Poster's
post? He already knows that you delete items from a dictionary with del,
and he posted code and the traceback he gets when he runs it.




-- 
Steven.




More information about the Python-list mailing list