From 0839429aed5cf8324e0db3908997702346b9af83 Mon Sep 17 00:00:00 2001 From: Jude Robinson Date: Sat, 3 Mar 2012 23:52:23 +0000 Subject: [PATCH] handle single digit dates --- noms | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/noms b/noms index f421389..372116f 100755 --- a/noms +++ b/noms @@ -35,8 +35,11 @@ if now.strftime('%H') >= '09' and now.strftime('%H') < '14': firstDateHeading = soup.find('div', 'heading-blue') date = re.sub('^[^0-9]+', '', firstDateHeading.contents[0].string) day = re.search('^[0-9]+', date) + # add leading zero to single digit dates + if len(day.group(0)) == 1: + day = '0' + day.group(0) monthYear = re.search('[a-zA-Z]+ [0-9]+$', date) - firstDate = day.group(0) + ' ' + monthYear.group(0) + firstDate = day + ' ' + monthYear.group(0) # see if that first date matches today's date if now.strftime('%d %b %Y') == firstDate: