1
halfcrazy 2016 年 11 月 30 日
```python
# -*- coding: utf-8 -*- import re pattern = "</?(\w+)>" txt = "<DIV>Windows XP</DIV><A>Windows XP</A><script>Windows XP</script>" def _sub(matchobj): return matchobj.group(0).replace(matchobj.group(1), matchobj.group(1).lower()) print(re.sub(pattern, _sub, txt)) ``` |