代码示例:(标识:python_datetime_2)
python_datetime_2.py
import datetime

x = datetime.datetime.now()

print(x.year)
print(x.strftime("%A"))
运行结果: