changeset 64 | 333092b68926 |
child 354 | 5dc6c3673f9d |
63:f5eac04a00fe | 64:333092b68926 |
---|---|
1 def get_date_from_str(date_str): |
|
2 month2mm = { |
|
3 'January': 1, |
|
4 'February': 2, |
|
5 'March': 3, |
|
6 'April': 4, |
|
7 'May': 5, |
|
8 'June': 6, |
|
9 'July': 7, |
|
10 'August': 8, |
|
11 'September': 9, |
|
12 'October': 10, |
|
13 'November': 11, |
|
14 'December': 12, |
|
15 } |
|
16 |
|
17 dd, month, yyyy = date_str.split() |
|
18 |
|
19 mm = month2mm[month] |
|
20 return int(yyyy), int(dd.strip(',')), mm |
|
21 |
|
22 date_str = raw_input('Enter a date string? ') |
|
23 print get_date_from_str(date_str) |