Thanks to visit codestin.com Credit goes to github.com
We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent d73e8e1 commit 92d520aCopy full SHA for 92d520a
python_base/2_1.py
@@ -0,0 +1,34 @@
1
+#! /usr/bin env python
2
+#根据给定的年月日以数字的形式打印日期
3
+#2012-10-23 XXG
4
+
5
+months = [
6
+ 'Jan',
7
+ 'Feb',
8
+ 'Mar',
9
+ 'Apr',
10
+ 'May',
11
+ 'Jun',
12
+ 'Jul',
13
+ 'Aug',
14
+ 'Sep',
15
+ 'Oct',
16
+ 'Nov',
17
+ 'Dec'
18
+ ]
19
20
+endings = ['st','nd','rd'] + 17 * ['th'] \
21
+ + ['st','nd','rd'] + 7 * ['th'] \
22
+ + ['st']
23
24
+year = raw_input("year:")
25
+month = raw_input("month(1-12):")
26
+day = raw_input("day(1-31):")
27
28
+month_number = int(month)
29
+day_number = int(day)
30
31
+month_name = months[month_number - 1]
32
+ordinal = day + endings[day_number - 1]
33
34
+print month_name + ' ' + ordinal + '.' + year
0 commit comments