How to parse strings into time ranges in Python?
Question: 
    time_ranges = ['Sunday-Thursday: 5:00 pm - 8:00 pm', 'Friday - Saturday: 1:00 pm - 2:00 pm']
    

Is there a simple way to turn the likes of a list of strings shown above into
datetime ranges? Is there a package or library that would make this task easy?


Answer: Here's one way of doing it using a list of business hours:

    
    
    import datetime
    Now = datetime.datetime.now()
    business_hours = [(8,18),(8,18),(12,18),(8,18),(8,20),(8,20),(-1,-1)]
    for i in range(6):
        Now = datetime.datetime.now() + datetime.timedelta(days=i)
        if Now.hour >= business_hours[Now.weekday()][0]\
            and Now.hour <= business_hours[Now.weekday()][1]:
            print Now.strftime("%a %d-%m-%Y"), "The store is open"
        else:
            print Now.strftime("%a %d-%m-%Y"), "The Store is closed"
    

Results:

    
    
    Sun 13-12-2015 The Store is closed
    Mon 14-12-2015 The store is open
    Tue 15-12-2015 The store is open
    Wed 16-12-2015 The Store is closed
    Thu 17-12-2015 The store is open
    Fri 18-12-2015 The store is open
    

Obviously this example attempts to prove the point using multiple dates, for
your purposes, you would dump the `for range` loop and just test `Now`.  
Beware of the difference between `weekday` and `isoweekday` which treat the
first day of the week, Monday or Sunday, differently i.e. `weekday` where
Monday is 0 and Sunday is 6 and `isoweekday` where Monday is 1 and Sunday is 7

