# -*- coding: utf-8 -*- import openpyxl, io wb=openpyxl.load_workbook("한국지역난방공사.xlsx"); ws=wb.active out=io.open("_siteq_out.txt","w",encoding="utf-8") for r in range(3, ws.max_row+1): L=ws.cell(r,12).value; K=ws.cell(r,11).value or "" if (L and str(L).strip()=="사이트") or "/cyb/" in str(K): d=[ws.cell(r,c).value for c in range(4,11)] path=" > ".join(str(x).strip() for x in d if x not in(None,"")) out.write(f"r{r} B{ws.cell(r,2).value}\tL={L}\t{path}\t{K}\n") out.close(); print("done")