Hi can someone help me to create a right path for my files in python? My path must be exported/files/{t}/{y}/filename. If i put in dir variable {y} on the end it won't work for some reason. My code is
tables=["table1","table2"]
years=["2010","2020"]
months=[1,2,3,4...12]
for t in tables:
for y in years:
for m in months:
dir=(f"exported/files/{t}")
os.mkdir(dir)
sqlcode="select * from {t} where some condition..."
filename= (f"{t}_{y}_{m}.sql")
with open(os.path.join(dir,filename_),"w") as writer:
writer.write(sqlcode)
exist_ok=True