title: How to find a number of workdays between two dates in Python?
body: <p>I have two dates as <code>datetime.date</code> objects, what is the most Pythonic way to find a number of workdays between these two dates (including starting and excluding ending date)? For example:</p>
  
  <pre><code>from datetime import date, timedelta
  
  d1 = date(2019, 3, 1)
  d2 = date(2019, 5, 6)
  # The difference between d2 and d1 is 46 workdays
  </code></pre>
  
  <p>Writting a loop comes to my mind:</p>
  
  <pre><code>workdays = 0
  for i in range((d2 - d1).days):
      if (d1 + timedelta(days=i)).isoweekday() &lt;= 5:
          workdays += 1
  </code></pre>
  
  <p>However, I think there is a simpler way to solve this problem.</p>