Am 10.06.2013 10:04, schrieb Νικόλαος Κούρας:
months = { 'Ιανουάριος':1, 'Φεβρουάριος':2, 'Μάρτιος':3, 'Απρίλιος':4, 
'Μάϊος':5, 'Ιούνιος':6, \
           'Ιούλιος':7, 'Αύγουστος':8, 'Σεπτέμβριος':9, 'Οκτώβριος':10, 
'Νοέμβριος':11, 'Δεκέμβριος':12 }

for key in sorted( months.keys() ):
================

I'm having trouble ordering a dictionary though.

I can't find a problem here. I tried simple dictionaries containing numbers as keys using Python 3.3, and sorting the keys works without any problem there. What exactly is the "trouble" you are having? Be a bit more precise and describe what you saw and, just in case, also what you expected to see.

BTW: You have a line continuation there using a backslash. This isn't necessary, since the pair of {} automatically tell Python the target range.


Good luck!

Uli


--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to