Skip to content

Instantly share code, notes, and snippets.

@artofhuman
Created September 10, 2012 20:03
Show Gist options
  • Save artofhuman/3693476 to your computer and use it in GitHub Desktop.
Save artofhuman/3693476 to your computer and use it in GitHub Desktop.
Python
years = [str(item.active_from.year) for item in news_list]
dates = list(enumerate(years, start=1))
result_years = [key for key,group in itertools.groupby(dates, key=lambda x: x[1][:11])]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment