python 判断星期几

from datetime import datetime
 
today = datetime.now().weekday()
 
print("0表示周一,2表示周二,...,6表示周日")
 
print('查看今天周几:')
 
print(today)
 
week=datetime.strptime("20191001", "%Y%m%d").weekday()
 
print('查看19年国庆周几:')
 
print(week)

 

posted @ 2021-02-25 15:47  清源居士  阅读(1811)  评论(0编辑  收藏  举报