import re html='脚本分享网,欢迎大家光临!' dr = re.compile(r'<[^>]+>',re.S) dd = dr.sub('',html) print(dd)