标签:strong att python strip strip() ret mil str replace
def clean(string):
pattern = re.compile(r‘<[^>]+>‘, re.S)
string = pattern.sub(‘‘, string)
string = string.replace(‘\n‘, ‘ ‘).replace(‘\r‘, ‘ ‘).replace(‘ ‘, ‘ ‘).replace(‘\t‘, ‘ ‘).replace(" ",‘‘)
string = string.strip()
return string
标签:strong att python strip strip() ret mil str replace
原文地址:https://www.cnblogs.com/yp19970/p/12743741.html