dict duplicity
Randy Bush
randy at psg.com
Fri Aug 19 00:25:38 EDT 2005
> Firstly, to remove one possible source of confusion, change the name of
> your dictionary ... "mydict" or "fred" ... anything but "dict"
>
> Next, after you have created the dictionary and added items to it, do this:
> print len(fred)
> print len(fred.items())
> nitems = 0
> for k, v in fred.iteritems():
> nitems += 1
> print nitems
>
> If by this stage you haven't worked out what you are doing wrong, post
> an exact copy/paste of the MINIMAL code that exhibits the "multiple
> instances of same key in <dictionary>.iteritems()" problem
i did not work out what i was doing wrongly. but now it works. i
hate <bleep>ing magic!
but thanks for making me permute.
randy
More information about the Python-list
mailing list