Advertisement
webs86

Giorni lavorativi

Nov 8th, 2013
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.61 KB | None | 0 0
  1. import datetime
  2. from dateutil import rrule
  3. alpha=datetime.date(2004, 01, 01) # change to accept input
  4. omega=datetime.date(2004, 02, 01) # change to accept input
  5. dates=rrule.rruleset() # create an rrule.rruleset instance
  6. dates.rrule(rrule.rrule(rrule.FREQ_DAILY, dtstart=alpha, until=omega))
  7.              # this set is INCLUSIVE of alpha and omega
  8. dates.exrule(rrule.rrule(rrule.FREQ_DAILY,
  9.                         byweekday=(rrule.SA, rrule.SU),
  10.                         dtstart=alpha))
  11. # here's where we exclude the weekend dates
  12. print len(list(dates)) # there's probably a faster way to handle this
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement