Using If statements in Python: If datetime.day == WEDNESDAY then call wed_module()
Question: Okay I want to call a different module for each day of the week in Python. My
code right now looks like this:

    
    
    def today_Shift():
        import time
        import datetime
        import calendar
        print "Day of week:", datetime.date.today().strftime("%A")
    
    #This gives me the day of the week. 
    #Now I need to know what to compare to what, to determine if for example the day of the       #week is == wednesday. 
    #If the day of the week is == Wednesday Then
    # call wed_info
    #elif:
    # call tues_info
    #etc.
    


Answer: You can have specific functions for each day of the week that do whatever.

    
    
    def wedFunc():
        print "This is for wednesday"
    
    def friFunc():
        print "This is for friday"
    

Then you can make a dictionary that maps the day to the function

    
    
    dayFunctionDict = {"Wednesday" : wedFunc, "Friday" : friFunc}
    

Then you call the appropriate function:

    
    
    >>> dayFunctionDict['Wednesday']()
    This is for wednesday
    

Using `datetime`

    
    
    >>> dayFunctionDict[datetime.date.today().strftime("%A")]()
    This is for wednesday
    

