append to the end of a dictionary

Justin Azoff justin.azoff at gmail.com
Wed Jan 25 08:21:01 EST 2006


Magnus Lycka wrote:
 > orderedListOfTuples = [(k,mydict[k]) for k in sorted(mydict.keys())]

orderedListOfTuples = sorted(mydict.items())

> It's great that many people try to help out on comp.lang.python,
> the community won't survive otherwise, but I think it's important
> to test answers before posting them, unless you're sure about your
> answer. A wrong answer might actually be worse than no answer at
> all. I fear that newbies will just get scared off if they get bunch
> a of replies to their questions, and most are wrong.

indeed.

-- 
- Justin




More information about the Python-list mailing list