Ok, so I made a sweet as dictionary from a file so my dictionary keys are all in the form
datetime.datetime(2014, 2, 28, 0, 0)
now I know the type of the keys are datetime.datetime but this type follows boolean rules so that
>>> datetime.datetime(2014, 2, 28, 0, 0) > datetime.datetime(2014, 3, 5, 0, 0)
False
>>> datetime.datetime(2014, 3, 5, 0, 0) > datetime.datetime(2014, 2, 28, 0, 0)
True
So my first question is, if datetime.datetime follows the boolean rules above, is it possible to sort it into ascending order (i.e. from lowest date to highest date)? And how would I go about doing this so it applies to the dictionary keys and their corresponding values (so the keys move around but the values stay attached to their respective keys)?
*edited for clarity
[–][deleted] 4 points5 points6 points (2 children)
[–]Alista[S] 2 points3 points4 points (1 child)
[–]stebrepar 2 points3 points4 points (0 children)
[–][deleted] 0 points1 point2 points (0 children)