Skip to content

Instantly share code, notes, and snippets.

@carlynorama
Created January 4, 2018 21:36
Show Gist options
  • Select an option

  • Save carlynorama/df231681de50b2098b2a2d18f57abdbf to your computer and use it in GitHub Desktop.

Select an option

Save carlynorama/df231681de50b2098b2a2d18f57abdbf to your computer and use it in GitHub Desktop.
Playing around with Python 2.7 Calendar Module
import calendar
#https://docs.python.org/2/library/calendar.html
print(calendar.weekheader(5))
calendar.prcal(2018)
year = 2018
month = 2
#week = 1
calendar.setfirstweekday(calendar.SATURDAY)
my_cal = calendar.Calendar(6)
for w in my_cal.monthdatescalendar(year, month):
for d in w:
print(d)
my_cal = calendar.Calendar(6)
for w in my_cal.monthdays2calendar(year, month):
for d in w:
print(d)
#print(calendar.monthdays2calendar(year, month))
#calendar.prweek(year, month)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment