import re,sys,html def strip(t): t=re.sub(r'','',t) t=re.sub(r'<[^>]+>','',t) return html.unescape(t).strip() for f in sys.argv[1:]: s=open(f,encoding='utf-8').read() print("="*20,f) for tag in ["사건번호","사건명","선고일자","법원명","판결유형","참조판례","판시사항","판결요지"]: m=re.search(r'<%s>(.*?)'%(tag,tag),s,re.S) if m: print("["+tag+"]",strip(m.group(1))[:2200])