By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
464,776 Members | 1,238 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 464,776 IT Pros & Developers. It's quick & easy.

Re: Get dict value but not as reference.

P: n/a
On Wed, Jul 23, 2008 at 11:49 AM, Robert Rawlins
<ro************@thinkbluemedia.co.ukwrote:
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
Jul 23 '08 #1
Share this question for a faster answer!
Share on Google+

This discussion thread is closed

Replies have been disabled for this discussion.