After many tried this did the job: for key in sorted(months.items(),key=lambda num : num[1]): print(''' <option value="%s"> %s </option> ''' % (key[1], key[0]) )
but its really frustrating not being able to: for key in sorted( months.values() ): print(''' <option value="%s"> %s </option> ''' % (months[key], key) ) Which seemed to be an abivous way to do it. names set() was able to order like this why not the dictionary too? -- http://mail.python.org/mailman/listinfo/python-list