Dec-07-2016, 06:50 PM
Looks like what you have does work, though. It's just ugly as hell lol.
>>> re.sub(r'<title>(.+?)</title>', '<title>new title</title>', x, 0, re.IGNORECASE) '<html><head><title>new title</title></head></html>'What's the actual problem? Maybe the reason we're complaining about the style of your code, is because you never said what the issue is.