代码如下:
#encoding=utf-8
print '中国'
#获取上一个周几,如周五,星期五
import datetime, calendar
lastFriday = datetime.date.today()
oneday = datetime.timedelta(days = 1)
while lastFriday.weekday() != calendar.FRIDAY:
lastFriday -= oneday
print lastFriday.strftime('%A,%d-%b-%Y')
打印结果如下:
中国
Friday,14-Mar-2014