removing dictionary key-pair

Steve Holden steve at holdenweb.com
Fri Jun 9 10:26:38 EDT 2006


JD wrote:
> Hello,
> 
> I try to remove a dictionary key-pair (remove an entry), 
> but I'm unsuccessful. Does anyone know how to achieve this?
> 
> Thanks

  >>> d = {1: "one", 2: "two", 3: "three"}
  >>> del d[2]
  >>> d
{1: 'one', 3: 'three'}
  >>>

regards
  Steve
-- 
Steve Holden       +44 150 684 7255  +1 800 494 3119
Holden Web LLC/Ltd          http://www.holdenweb.com
Love me, love my blog  http://holdenweb.blogspot.com
Recent Ramblings     http://del.icio.us/steve.holden




More information about the Python-list mailing list