On Wed, Jul 23, 2008 at 11:49 AM, Robert Rawlins
<[EMAIL PROTECTED]> wrote:
> I have a dictionary, and I want to get one of the values from it, but rather
> than returning it as a reference I want to actually detach/remove the
> element from the dictionary. Like so:

Use the pop() method of the dictionary, like this:

>>> my_dict = {'a': 'Item A', 'b': 'Item B', 'c': 'Item C'}
>>> my_dict.pop('a')
'Item A'
>>> my_dict
{'c': 'Item C', 'b': 'Item B'}
>>>

-- 
Jerry
--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to