import sys, re sys.stdout.reconfigure(encoding='utf-8') p = r'D:\교안\KidsOrder_Week7_20260613.html' with open(p,'r',encoding='utf-8') as f: h = f.read() # 전체 슬라이드 div 개수 (엔딩 포함) total = len(re.findall(r'
{counter[0]} / {total}
' pattern = r'
[^<]+
' h2 = re.sub(pattern, renumber, h) print(f'재번호: 1~{counter[0]} / {total}') with open(p,'w',encoding='utf-8') as f: f.write(h2) print('저장 완료')