使用bs4模块 去除html标签方法

from bs4 import BeautifulSoups = ''' /usr/sbin/tgt-admin <span class="token comment">#配置工具</span>/usr/sbin/tgtadm <span class="token comment">#管理target工具</span>/usr/sbin/tgtd <span class="token comment">#服务进程程序</span>/usr/sbin/tgtimg <span class="token comment">#共享的映射文件设备工具</span></code></pre><div class="toolbar"></div></div>''''b = BeautifulSoup(s,"html.parser") #html.parser 是一个固定的值,是一个解析器print(b.text)