day1/exercise/datestring.py
branchscipy2010
changeset 425 5afcfce15e71
parent 386 a0bec380b44f
--- a/day1/exercise/datestring.py	Sun Jun 27 20:23:10 2010 -0500
+++ b/day1/exercise/datestring.py	Sun Jun 27 22:05:22 2010 -0500
@@ -1,14 +1,24 @@
-month2mm = { 'JAN': 1, 'FEB': 2, 'MAR': 3, 'APR': 4, 'MAY': 5, 'JUN': 6,
-'JUL': 7, 'AUG': 8, 'SEP': 9, 'OCT': 10, 'NOV': 11, 'DEC': 12 }
+month2mm = {'JAN': 1, 
+            'FEB': 2, 
+            'MAR': 3, 
+            'APR': 4, 
+            'MAY': 5, 
+            'JUN': 6,
+            'JUL': 7, 
+            'AUG': 8, 
+            'SEP': 9, 
+            'OCT': 10, 
+            'NOV': 11, 
+            'DEC': 12 }
 
 COMMA = ','
 SPACE = ' '
 date_str = raw_input('Enter a date string? ')
-date_str = date_str.replace( COMMA, SPACE)
-d, m, y = date_str.split()
-dd = int( d )
-mon = m[:3].upper()
+date_str = date_str.replace(COMMA, SPACE)
+day, month, year = date_str.split()
+dd = int(day)
+mon = month[:3].upper()
 mm = month2mm[mon]
-yyyy = int( y )
+yyyy = int(year)
 
-print dd,mm, yyyy
+print dd, mm, yyyy