python 3.x - Python3 How to replace some html tags use re -


i want quote contents {{ , }} in html tag strong/b/u use python3, how implement ?

import re n_start = ' {{' n_end = '}} ' tag in 'strong', 'u', 'b':     pat = r'<' + tag + '[^><]*>(.*?)</' + tag + '>'     html = re.sub(pat, lambda x: n_start + str(x.group(1)).strip() + n_end, html,                   flags=re.i | re.s | re.m) 

i want replace html code <u style="border:xxxx">aaa</u> <u style="border:xxxx">{{aaa}}</u>,html tag strong or b or u


Comments

Popular posts from this blog

python - Selenium remoteWebDriver (& SauceLabs) Firefox moseMoveTo action exception -

html - How to custom Bootstrap grid height? -

javascript - pass values from mssql to views in node -