I am a novice in python. My question relates to creating a dynamic path in python and there are multiple such posts such as How to create dynamic file sending algorithm with flask and How do I dynamically set the path of a file Python?. But the context in these is slightly different from mine. I need to create a new folder for each year and then save the output csv for each week for that year. I am making a mistake in dynamically setting y after E:\ and getting the following error.
Please suggest how can I parametrize the year in the folder path. Thanks.
def download_data(y):
Parallel(n_jobs=1)(delayed(get_bulk_patent_data)(y, w, output_file="E:\\y\\df"+str(y)+"w"+str(w)+"a.csv") for w in range(1, 3))
YEARS = [2021,2022]
for y in YEARS:
download_data(y)
FileNotFoundError: [Errno 2] No such file or directory: 'E:\y\df2021w1a.csv'