newbie question
Steven D'Aprano
steve at REMOVEME.cybersource.com.au
Sun Feb 25 19:59:20 EST 2007
On Sun, 25 Feb 2007 18:49:56 -0600, S.Mohideen wrote:
>>>> asd={}
>>>> asd={1:2,3:4,4:5}
You don't need to initialise asd to an empty dict.
>>>> print asd
> {1: 2, 3: 4, 4: 5}
>
>>>> asd.has_key(3)
> True
>>>> asd.update()
>>>> print asd
> {1: 2, 3: 4, 4: 5}
You're not updating it with anything.
> what does asd.update() signifies. What is the use of it. Any comments
> would help to understand it.
Try this:
>>> asd = {1: 2, 3: 4, 4: 5}
>>> D = {1: -99, 7: -99}
>>> asd.update(D)
>>> asd
{1: -99, 3: 4, 4: 5, 7: -99}
--
Steven D'Aprano
More information about the Python-list
mailing list