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