让Python打印漂亮的日期字符串?

mat*_*att 0 python calendar date

如何让Python输出

'星期四04''星期二05'

等,给定时间一周?

today = datetime.datetime.today()
### do some magic
days = ['Tue Jun 05',...]
Run Code Online (Sandbox Code Playgroud)

如何使用'今天'来生成结果?我甚至不确定我是否是正确的模块,日历似乎有相似的功能.

Hun*_*des 6

days = [today.strftime("%a %b %y"), ...]
Run Code Online (Sandbox Code Playgroud)

我们使用strftime获取datetime对象并将其格式化为字符串

http://docs.python.org/library/datetime.html#strftime-and-strptime-behavior