공공기관2 작업 중. _temp 몽타주(재생성가능)는 제외. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
33 lines
1.7 KiB
Python
33 lines
1.7 KiB
Python
# -*- coding: utf-8 -*-
|
|
# 청양 123+ L 고신뢰 정정만 적용: 외부→사이트(MNOPQ비움), 게시판URL/eminwon/시그널→게시판. med 다운그레이드는 미적용(보고만).
|
|
import openpyxl, json, io, sys, shutil
|
|
from collections import Counter
|
|
sys.stdout=io.TextIOWrapper(sys.stdout.buffer,encoding='utf-8')
|
|
F=r'D:\01.프로젝트\DB수집\작업파일\광역_사이트맵\충청남도\13.청양군\충청남도_청양군.xlsx'
|
|
BK=r'D:\01.프로젝트\DB수집\작업파일\광역_사이트맵\충청남도\13.청양군\충청남도_청양군_backup_L검토전.xlsx'
|
|
shutil.copyfile(F,BK); print('백업',BK)
|
|
res=json.load(open('_cy2_Lfull.json',encoding='utf-8'))
|
|
wb=openpyxl.load_workbook(F); ws=wb.active
|
|
applied=[]; skipped_med=[]
|
|
for rs,v in res.items():
|
|
r=int(rs); nv,why,oL,conf=v
|
|
if r<123: continue
|
|
if nv==oL or nv not in ('게시판','페이지','사이트'): continue
|
|
if conf!='high':
|
|
skipped_med.append((r,oL,nv,why)); continue
|
|
lab=str(ws.cell(r,6).value or ws.cell(r,7).value or ws.cell(r,5).value or '')[:16]
|
|
ws.cell(r,12).value=nv
|
|
if nv=='사이트':
|
|
for c in (13,14,15,16,17): ws.cell(r,c).value=None
|
|
applied.append((r,lab,oL,nv,why))
|
|
wb.save(F)
|
|
print('\n=== 적용(high) %d건 ==='%len(applied))
|
|
for r,lab,o,n,w in applied: print('r%d %-16s %s->%s [%s]'%(r,lab,o,n,w[:20]))
|
|
print('\n=== 미적용(med 다운그레이드, 검토필요) %d건 ==='%len(skipped_med))
|
|
for r,o,n,w in skipped_med:
|
|
lab=str(ws.cell(r,6).value or ws.cell(r,7).value or '')[:16]
|
|
print('r%d %-16s %s->%s? [%s]'%(r,lab,o,n,w[:24]))
|
|
print('\n적용 전이:',Counter((o,n) for _,_,o,n,_ in applied))
|
|
d=Counter(ws.cell(r,12).value for r in range(3,ws.max_row+1) if ws.cell(r,2).value)
|
|
print('최종 L분포:',dict(d))
|