且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

python从输入日期获取工作日

更新时间:2023-11-05 17:08:28

假设 s 是您的输入字符串:

Suppose s is your input string:

s = '2010-10-29'

在提示时,尝试 s .split('-')。会发生什么事?

At the prompt, try s.split('-'). What happens?

创建一个日期对象:

d = datetime.date(2010, 10, 29)

然后运行 d.strftime('%B')。怎么了?

您可以填写其余部分。查看Python文档以获取更多信息。 Python文档:时间 datetime

You can fill in the rest. Look at the Python docs for more information. Python doc: time, datetime