Advertisement
rfmonk

GSLUG_CAL.py

Jan 22nd, 2014
125
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.50 KB | None | 0 0
  1. #!/usr/bin/env python
  2.  
  3.  
  4. import calendar
  5.  
  6. # Show every month
  7. for month in range(1, 13):
  8.  
  9.     # Compute the dates for each week that overlaps the month
  10.     c = calendar.monthcalendar(2014, month)
  11.     first_week = c[0]
  12.     second_week = c[1]
  13.  
  14.     # Gslug meets on the first Saturday of the month
  15.     if first_week[calendar.SATURDAY]:
  16.         meeting_date = first_week[calendar.SATURDAY]
  17.     else:
  18.         meeting_date = second_week[calendar.SATURDAY]
  19.  
  20.     print '%3s: %2s' % (calendar.month_abbr[month], meeting_date)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement