python显示生日是星期几

2018-07-20    来源:open-open

容器云强势上线!快速搭建集群,上万Linux镜像随意使用
# find the day of the week of a given date
# Python will trap impossible dates like (1900, 2, 29)
# tested with Python24     vegaseat    01aug2005
 
from datetime import date
 
# a typical birthday  year, month, day
# or change it to your own birthday...
birthday = date(1983, 12, 25)
 
dayList = ['Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday', 'Sunday']
# date.weekday() returns 0 for Monday and so on, so pick the day string from the dayList
print "The day of the week on %s was a %s" % (birthday.strftime("%d%b%Y"), dayList[date.weekday(birthday)])

标签:

版权申明:本站文章部分自网络,如有侵权,请联系:west999com@outlook.com
特别注意:本站所有转载文章言论不代表本站观点!
本站所提供的图片等素材,版权归原作者所有,如需使用,请与原作者联系。

上一篇:python(PIL)图像处理(等比例压缩、裁剪压缩) 缩略(水印)图

下一篇:python编写的用于测试网站访问速率的代码片段