#! /usr/bin/env python# -*- coding:utf-8 -*-import datetimedef get_week_day(date): week_day = { 0: '星期一', 1: '星期二', 2: '星期三', 3: '星期四', 4: '星期五', 5: '星期六', 6: '星期日', } day = date.weekday() # weekday()可以获得是星期几 return week_day[day]print(datetime.date.today(), get_week_day(datetime.date.today())) 当然 datetime 模块下还有 isoweekday() 方法, 但是原理大同小异, isoweekday() 方法直接返回的是1-7