In a large program that iterates over many many dates, I'm trying to process only dates that are passed (or at) a
date >= cutoff_date. This works great 99% of the time, however check out the following:
>>> print cutoff_date, type(cutoff_date) 2015-2-19 <type 'str'> >>> a = '2015-3-20' >>> a >= cutoff_date True >>> b = '2015-1-2' >>> b >= cutoff_date False >>> c = '2015-2-9' >>> c >= cutoff_date True # I need this to be False ... >>> d = '2015-2-09' >>> d >= cutoff_date False # ... just like this >>>
I know that I could set up a function where if the day of a date is one digit, add a
0 to the front of it. However I fear that this could screw up the rest of my code. Therefore before I go doing so, I'm wondering if threre is an easier way to solve this?