공공기관2 작업 중. _temp 몽타주(재생성가능)는 제외. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
26 lines
1010 B
Python
26 lines
1010 B
Python
# -*- coding: utf-8 -*-
|
|
import openpyxl, sys, io, glob, os
|
|
sys.stdout=io.TextIOWrapper(sys.stdout.buffer,encoding='utf-8')
|
|
def urls(F):
|
|
wb=openpyxl.load_workbook(F); ws=wb.active
|
|
s=set()
|
|
for r in range(3,ws.max_row+1):
|
|
u=ws.cell(r,11).value
|
|
if u and str(u).startswith('http'):
|
|
uu=str(u).split('#')[0].rstrip('/')
|
|
s.add(uu)
|
|
return s
|
|
PAIRS={
|
|
'옥천':'5.옥천군\\충청북도_옥천군',
|
|
'음성':'6.음성군\\충청북도_음성군',
|
|
'제천':'7.제천시\\충청북도_제천시',
|
|
'청주':'10.청주시\\충청북도_청주시',
|
|
}
|
|
for nm,base in PAIRS.items():
|
|
new=base+'.xlsx'; bak=base+'_backup_재구축전.xlsx'
|
|
if not os.path.exists(bak): print(nm,'백업없음'); continue
|
|
un=urls(new); ub=urls(bak)
|
|
lost=ub-un; gain=un-ub
|
|
print('%s | 신규행url %d · 원본url %d | 원본에만(손실) %d · 신규에만(추가) %d'%(nm,len(un),len(ub),len(lost),len(gain)))
|
|
for u in list(lost)[:6]: print(' 손실:',u[:75])
|