DB_JOB/작업파일/공공기관2/10.한국지역난방공사/_menuno.py
hehihoho3 b0acd1e705 백업: 셀병합 정상화(D~J)+KDHC 옵션2/행높이17, 오늘(06-21) 제출 17곳 검수·압축
- 공공기관2/3 작업본 + 오늘 제출 17곳 D~J 카테고리 셀병합 정상화
- 한국지역난방공사 옵션2(고아셀 F98 수정)+전행 높이17
- 제출_프리랜서2_2026-06-21.zip 생성(17개 xlsx, 2,468행)

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-21 13:21:26 +09:00

35 lines
1.2 KiB
Python

# -*- coding: utf-8 -*-
import openpyxl, io, re
from collections import defaultdict
wb=openpyxl.load_workbook("한국지역난방공사.xlsx"); ws=wb.active
out=io.open("_menuno_out.txt","w",encoding="utf-8")
def w(*a): out.write(" ".join(str(x) for x in a)+"\n")
def sig(K):
if not K: return None
K=str(K)
m=re.search(r'menuNo=(\d+)',K)
b=re.search(r'/(B\d{6,})/',K)
mc=re.search(r'menuCode=(M\d+)',K)
parts=[]
if b: parts.append("bbs="+b.group(1))
if m: parts.append("menuNo="+m.group(1))
if mc: parts.append("menuCode="+mc.group(1))
return "|".join(parts) if parts else K[:50]
groups=defaultdict(list)
for r in range(3, ws.max_row+1):
K=ws.cell(r,11).value
s=sig(K)
if s: groups[s].append(r)
w("=== same page signature (menuNo / bbs / menuCode) on >1 row ===")
cnt=0
for s,rs in groups.items():
if len(rs)>1:
cnt+=1
for rr in rs:
d=[ws.cell(rr,c).value for c in range(4,11)]
path=" > ".join(str(x).strip() for x in d if x not in(None,""))
w(" r%d B%s L=%s M=%s | %s"%(rr,ws.cell(rr,2).value,ws.cell(rr,12).value,ws.cell(rr,13).value,path))
w(" SIG:",s,"K0=",str(ws.cell(rs[0],11).value),"\n")
w("groups with dup signature:",cnt)
out.close(); print("done")