import sys, re sys.stdout.reconfigure(encoding='utf-8') h = open(r'D:\교안\KidsOrder_Week7_20260613.html', encoding='utf-8').read() # ', h, re.DOTALL) js = m.group(1) # 중괄호/소괄호/대괄호 균형 검사 pairs = {'(':')', '{':'}', '[':']'} stack = [] ok = True in_str = None i = 0 # 간단 검사: 문자열/주석 무시는 생략, 대략적 균형만 for ch in js: if ch in '({[': stack.append(ch) elif ch in ')}]': if not stack: ok = False break last = stack.pop() if pairs[last] != ch: ok = False break print('괄호 균형:', 'OK' if (ok and not stack) else f'불균형 (남은: {stack})') # applyScale 잔여 참조 재확인 print('applyScale 참조:', js.count('applyScale')) print('MIN_SCALE 참조:', js.count('MIN_SCALE')) # 함수 정의 목록 funcs = re.findall(r'function\s+(\w+)', js) print('정의된 함수:', funcs) # script 블록 줄 수 print('JS 줄 수:', len(js.split(chr(10)))) # node로 문법 검사 가능한지 js_clean = js.strip() with open(r'D:\교안\_jscheck.js','w',encoding='utf-8') as f: f.write(js_clean) print('JS 추출 완료 → _jscheck.js')