Re: Problem in Dictionaries

2005-03-02 Thread Terry Reedy
"Glauco Silva" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] >I would like to know if the dictionary can sort with a function that i >give to then! No. You have to either make a list of key,value items and sort that, possibly with a cmp or key parameter items = d.items() items.

Problem in Dictionaries

2005-03-01 Thread Glauco Silva
I´m with problem in Dictionaries ! I would like to know if the dictionary can sort with a function that i give to then! Because i need to have a dictionary sort by key ! For exemple : dict  = {} dict[50] = "fifty" dict[129] = "a hundred twenty nine" print dict {129: "a