24 lines
976 B
Python
24 lines
976 B
Python
# -*- coding: utf-8 -*-
|
|
import io, sys
|
|
for f in sys.argv[1:]:
|
|
c = io.open(f, encoding='utf-8').read()
|
|
print('===', f.replace('\\', '/').split('/')[-1])
|
|
for label, needle in [
|
|
('CSS .prob-detail', '.prob-detail{border'),
|
|
('CSS .prob-body', '.prob-body{display:none'),
|
|
('CSS .prob-code', '.prob-code{background'),
|
|
('📋 题目', '📋 题目'),
|
|
('👦 孩子的代码', '👦 孩子的代码'),
|
|
('✅ 参考答案', '✅ 参考答案'),
|
|
('💡 解析', '💡 解析'),
|
|
('题目讲解标题', '题目讲解'),
|
|
]:
|
|
print(' %-18s count=%d' % (label, c.count(needle)))
|
|
# show a real panel sample (find first prob-body, strip tags for a peek)
|
|
import re
|
|
m = re.search(r'<div class="prob-body">(.*?)</div></div></div>', c, re.S)
|
|
if m:
|
|
txt = re.sub(r'<[^>]+>', ' ', m.group(1))
|
|
txt = re.sub(r'\s+', ' ', txt)
|
|
print(' first-panel text snippet:', txt[:180])
|