bsddb for k, v in db.items(): do order the numbers ?

Christopher De Vries devries at idolstarastronomer.com
Mon Feb 28 11:48:44 EST 2005


On Mon, Feb 28, 2005 at 08:30:59AM -0800, martijn at gamecreators.nl wrote:
> WHen I use the code below and printing all the results i get this:
> ------
> 0 1 10
> 11 2 3
> 4 5 6
> 7 8 9
> ------
> But I want
> ------
> 0 1 2
> 3 4 5
> 6 7 8
> 9 10 11
> ------

If you want your key, value pairs in a certain order you have to sort them
yourself. Dictionaries and bsddb keys are unsorted.

Chris



More information about the Python-list mailing list