Skip to content

Instantly share code, notes, and snippets.

@Telling
Created August 20, 2015 21:36
Show Gist options
  • Save Telling/8c222378db09068c3d81 to your computer and use it in GitHub Desktop.
Save Telling/8c222378db09068c3d81 to your computer and use it in GitHub Desktop.
sort by yeah, month on wierd string
@property
def by_year_month(self):
""" Sorts the list, and returns it sorted by year and month.
"""
self.webalizer_months.sort(
key=lambda x: (int(x.split(' ', 1)[0]), int(x.split(' ', 2)[1]))
)
return self.webalizer_months
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment