I am trying to write a Python script that will calculate how many business days are in the current month. For instance if month = August
then businessDays = 22
.
Here is my code for discovering the month:
def numToMonth( num ):
months = ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"]
return str(months[ num - 1 ])
This code works fine, and I could hard code another function to match the month with how many days that month should contain...but this does not help me with business days.
Any help? I'm used to C, C++ so please don't bash my Python "skills".
Edit: I cannot install any extra libraries or modules on my machine, so please post answers using default Python modules. (Python 2.7, datetime
etc.) Also, my PC has Windows 7 OS.