代码:
#!/usr/bin/python # -*- coding: UTF-8 -*- import datetime dd = raw_input("输入日期:") dd = datetime.datetime.strptime(dd, "%Y%m%d") print dd.timetuple().tm_yday
输出:
输入日期:20200608 160
Python | 输入日期返回该日期是该年的第几天
原文:https://www.cnblogs.com/Cchblogs/p/13065830.html