使用bs4模塊 去除html標籤方法
from bs4 import BeautifulSoup
s = '''
/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)