Skip to content

Instantly share code, notes, and snippets.

@alexandre
Created August 7, 2014 13:00
Show Gist options
  • Select an option

  • Save alexandre/fe68ccaa8538ec29a0b5 to your computer and use it in GitHub Desktop.

Select an option

Save alexandre/fe68ccaa8538ec29a0b5 to your computer and use it in GitHub Desktop.
yet another code example...
'''
unpacking nested list
'''
year = datetime.date.today().year
month = datetime.date.today().month
# My nested list
cal = calendar.Calendar(6).monthdatescalendar(year, month)
# damn! I just wanna a simple list...
# hey wait...
days = [day for week in cal for day in week]
# =]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment