import datetime nowtime=datetime.datetime.now() print(nowtime) nowweekday=nowtime.weekday() print(nowweekday) #星期三,显示的2
》》》》
2020-01-08 21:30:59.2168462