使用功能进行替换
s = 'The struct-of-application and struct-of-world'p = re.compile('((w+-)+w+)')def replace(match): return 'http://{}'.format(match.group()) #for python 3.6+ ... #return f'http://{match.group()}'>>> p.sub(replace, s)'The http://struct-of-application and http://struct-of-world'>>>


