How do I count only weekdays from timedelta in python
Question: I am getting the number of days until the next "billing cycle" (for example)
which starts on the `nth` day of the month:

    
    
    from dateutil.relativedelta import relativedelta
    
    dt = datetime.utcnow() + relativedelta(months=1,day=schedule.cycle_start)
    days_till_next_cycle = dt - datetime.utcnow()
    

Where `schedule.cycle_start` is going to be something like `2` for the second
day of the month.

This works... But:

**How do I find the number of weekdays in that`timedelta`.**

I took a look at <https://pypi.python.org/pypi/BusinessHours/> and could not
find any documentation.

I also saw this: [Business days in
Python](http://stackoverflow.com/questions/2224742/business-days-in-python)
which linked me to the link above and rolling my own. It's also been 4 years
since that post and I was hoping there might be a simpler way?


Answer: With rrule I was able get the following using the dt definition from above:

    
    
        from dateutil.rrule import *
        number_weekdays = rrule(WEEKLY, byweekday=(MO,TU,WE,TH,FR), dtstart=datetime.utcnow(),until=dt).count()
    

