问题描述参见Python:日期表达的转换(day of year & year month day) - 阿尔伯塔 - 博客园 (cnblogs.com)
year-month-day 转 day of year参考Python 年月日、儒略日、年纪日互转函数_python将年月日转换为简约儒略日_OSurer的博客-CSDN博客
对于day of year 转 year-month-day:
假设day of year 是 “2019133”,代码如下
import datetime as dt
doy_date = “2019133”
year = int(doy_date[0:4])
doy = int(doy_date[4:])
start_date = datetime.datetime(year,1,1)
date = (start_date + datetime.timedelta(days=doy-1)).strftime("%Y/%m/%d")
print(date) # 2019/05/13
善于利用python自带的库会更高效