title: Sequence of datetimes except weekends Python
body: <p>I'm trying to create a sequence of datetime object but excluding weekends. So far I've successfully created a sequence of dates from any given start date to end date, but I'm having trouble figuring out how to exclude weekends:</p>
  
  <pre><code># Generate sequence of dates
  startDate = datetime.datetime.strptime(start, '%Y-%m-%d').date()
  endDate = datetime.datetime.strptime(end, '%Y-%m-%d').date()
  nb_days = (endDate - startDate).days + 1  # + 1 because range is exclusive
  dates = [startDate + datetime.timedelta(days=x) for x in range(nb_days)]
  </code></pre>