《 span lang="EN-US" style="font-size: 16pt;"》天空《/span 》《 p class="MsoNormal" style="text-indent:28.0pt;mso-char-indent-count:2.0;line-height:20.0pt;mso-line-height-rule:exactly"》
我想把类似上面这样的 html 代码(为了方便发布,我把尖括号换成了《》)精简下,精简成下面这样:
《 span 》天空《/span 》《 p style="text-indent:28.0pt;line-height:20.0pt;"》
能看出,我把《 span 》中的 lang 和字号属性删掉了,把《 p 》中 style 属性里的首行缩进和行高留了下来,删除了其他的。 我想知道除了 BS4,其他还有能处理我这个需求的库吗? BS4 能处理 lang、class 这样的属性,但是 style 里面的属性没法处理。