I am trying to write a Python script that calculates the number of working days in the current month. For example, if month = August , then businessDays = 22 .
Here is my month detection code:
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 this month should contain ... but that does not help me on weekdays.
Any help? I'm used to C, C ++, so please don't bash my Python skills. "
Edit: I cannot install any additional libraries or modules on my computer, so please submit responses using Python default modules. (Python 2.7, datetime , etc.) In addition, Windows 7 is installed on my PC.
source share